diff options
author | Haowen Bai <baihaowen@meizu.com> | 2022-03-30 03:59:48 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-03-30 14:17:25 +0200 |
commit | 2609f635a20d3691e7b5725edc3bdadb7bedf8fb (patch) | |
tree | dcb550bbc325a0825a743a70852b85ffb5fceb51 /tools/testing | |
parent | bpf: Fix sparse warnings in kprobe_multi_resolve_syms (diff) | |
download | linux-2609f635a20d3691e7b5725edc3bdadb7bedf8fb.tar.xz linux-2609f635a20d3691e7b5725edc3bdadb7bedf8fb.zip |
selftests/bpf: Fix warning comparing pointer to 0
Avoid pointer type value compared with 0 to make code clear. Reported by
coccicheck:
tools/testing/selftests/bpf/progs/map_ptr_kern.c:370:21-22:
WARNING comparing pointer to 0
tools/testing/selftests/bpf/progs/map_ptr_kern.c:397:21-22:
WARNING comparing pointer to 0
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/1648605588-19269-1-git-send-email-baihaowen@meizu.com
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/bpf/progs/map_ptr_kern.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c index b64df94ec476..db388f593d0a 100644 --- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c +++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c @@ -367,7 +367,7 @@ static inline int check_array_of_maps(void) VERIFY(check_default(&array_of_maps->map, map)); inner_map = bpf_map_lookup_elem(array_of_maps, &key); - VERIFY(inner_map != 0); + VERIFY(inner_map != NULL); VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES); return 1; @@ -394,7 +394,7 @@ static inline int check_hash_of_maps(void) VERIFY(check_default(&hash_of_maps->map, map)); inner_map = bpf_map_lookup_elem(hash_of_maps, &key); - VERIFY(inner_map != 0); + VERIFY(inner_map != NULL); VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES); return 1; |