Skip to content

Commit 2609f63

Browse files
Lotte-Baiborkmann
authored andcommitted
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
1 parent d31e038 commit 2609f63

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/testing/selftests/bpf/progs/map_ptr_kern.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static inline int check_array_of_maps(void)
367367

368368
VERIFY(check_default(&array_of_maps->map, map));
369369
inner_map = bpf_map_lookup_elem(array_of_maps, &key);
370-
VERIFY(inner_map != 0);
370+
VERIFY(inner_map != NULL);
371371
VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);
372372

373373
return 1;
@@ -394,7 +394,7 @@ static inline int check_hash_of_maps(void)
394394

395395
VERIFY(check_default(&hash_of_maps->map, map));
396396
inner_map = bpf_map_lookup_elem(hash_of_maps, &key);
397-
VERIFY(inner_map != 0);
397+
VERIFY(inner_map != NULL);
398398
VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);
399399

400400
return 1;

0 commit comments

Comments
 (0)