Skip to content

Commit

Permalink
selftests/bpf: Fix warning comparing pointer to 0
Browse files Browse the repository at this point in the history
Fix the following coccicheck warning:

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

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/1615357366-97612-1-git-send-email-jiapeng.chong@linux.alibaba.com
  • Loading branch information
Jiapeng Chong authored and anakryiko committed Mar 10, 2021
1 parent c1acda9 commit 04ea63e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/test_global_func10.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Big {

__noinline int foo(const struct Big *big)
{
if (big == 0)
if (!big)
return 0;

return bpf_get_prandom_u32() < big->y;
Expand Down

0 comments on commit 04ea63e

Please sign in to comment.