From: Geliang Tang <tanggeli...@kylinos.cn>

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 <tanggeli...@kylinos.cn>
---
 tools/testing/selftests/bpf/test_sockmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_sockmap.c 
b/tools/testing/selftests/bpf/test_sockmap.c
index fde0dd741e69..e7dbf49a2ca6 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -1030,7 +1030,7 @@ static int run_options(struct sockmap_options *options, 
int cg_fd,  int test)
                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 @@ static int run_options(struct sockmap_options *options, 
int cg_fd,  int test)
                        goto out;
                }
 
+               i = 0;
                err = bpf_map_update_elem(map_fd[1], &i, &c1, BPF_ANY);
                if (err) {
                        fprintf(stderr,
-- 
2.43.0


Reply via email to