selftests/bpf: Drop duplicate definition of i in test_sockmap
authorGeliang Tang <tanggeliang@kylinos.cn>
Thu, 23 May 2024 06:49:58 +0000 (14:49 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 3 Jun 2024 17:32:54 +0000 (19:32 +0200)
There's already a definition of i in run_options() at the beginning, no
need to define a new one in "if (tx_prog_fd > 0)" block.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/8d690682330a59361562bca75d6903253d16f312.1716446893.git.tanggeliang@kylinos.cn
tools/testing/selftests/bpf/test_sockmap.c

index 892a690..6d724fe 100644 (file)
@@ -1030,7 +1030,7 @@ run:
                tx_prog_fd = -1;
 
        if (tx_prog_fd > 0) {
-               int redir_fd, i = 0;
+               int redir_fd;
 
                err = bpf_prog_attach(tx_prog_fd,
                                      map_fd[1], BPF_SK_MSG_VERDICT, 0);
@@ -1041,6 +1041,7 @@ run:
                        goto out;
                }
 
+               i = 0;
                err = bpf_map_update_elem(map_fd[1], &i, &c1, BPF_ANY);
                if (err) {
                        fprintf(stderr,