Avoid pointer type value compared with 0 to make code clear.

./tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c:221:10-11: WARNING 
comparing pointer to 0.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=23403
Signed-off-by: Jiapeng Chong <[email protected]>
---
 tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c 
b/tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c
index 4f94c971ae86..6b725725b2bf 100644
--- a/tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c
+++ b/tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c
@@ -218,7 +218,7 @@ int null_check(void *ctx)
        int *p;
 
        p = bpf_rdonly_cast(0, 0);
-       if (p == 0)
+       if (!p)
                /* make this a function call to avoid compiler
                 * moving r0 assignment before check.
                 */
-- 
2.43.5


Reply via email to