selftests/bpf: fix a few clang compilation errors
authorYonghong Song <yhs@fb.com>
Wed, 11 May 2022 18:47:35 +0000 (11:47 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 11 May 2022 19:58:12 +0000 (12:58 -0700)
commitfd0ad6f1d10c01796904608aacd6e70d6f624305
tree5bd96670e8512ba6729d0d407c348ab6f490096f
parent998e1869de1b10caec6ec940632ff271036926f5
selftests/bpf: fix a few clang compilation errors

With latest clang, I got the following compilation errors:
  .../prog_tests/test_tunnel.c:291:6: error: variable 'local_ip_map_fd' is used uninitialized
     whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
       if (attach_tc_prog(&tc_hook, -1, set_dst_prog_fd))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  .../bpf/prog_tests/test_tunnel.c:312:6: note: uninitialized use occurs here
        if (local_ip_map_fd >= 0)
            ^~~~~~~~~~~~~~~
  ...
  .../prog_tests/kprobe_multi_test.c:346:6: error: variable 'err' is used uninitialized
      whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (IS_ERR(map))
            ^~~~~~~~~~~
  .../prog_tests/kprobe_multi_test.c:388:6: note: uninitialized use occurs here
        if (err) {
            ^~~

This patch fixed the above compilation errors.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20220511184735.3670214-1-yhs@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
tools/testing/selftests/bpf/prog_tests/test_tunnel.c