Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix warning comparing pointer to 0

Fix the following coccicheck warnings:

./tools/testing/selftests/bpf/progs/fexit_test.c:77:15-16: WARNING
comparing pointer to 0.

./tools/testing/selftests/bpf/progs/fexit_test.c:68:12-13: WARNING
comparing pointer to 0.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/1615881577-3493-1-git-send-email-jiapeng.chong@linux.alibaba.com

authored by

Jiapeng Chong and committed by
Daniel Borkmann
ebda107e 5531939a

+2 -2
+2 -2
tools/testing/selftests/bpf/progs/fexit_test.c
··· 65 65 SEC("fexit/bpf_fentry_test7") 66 66 int BPF_PROG(test7, struct bpf_fentry_test_t *arg) 67 67 { 68 - if (arg == 0) 68 + if (!arg) 69 69 test7_result = 1; 70 70 return 0; 71 71 } ··· 74 74 SEC("fexit/bpf_fentry_test8") 75 75 int BPF_PROG(test8, struct bpf_fentry_test_t *arg) 76 76 { 77 - if (arg->a == 0) 77 + if (!arg->a) 78 78 test8_result = 1; 79 79 return 0; 80 80 }