bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] selftests/bpf: Fix warning comparing pointer to 0
@ 2025-08-07  1:54 Jiapeng Chong
  2025-08-07  1:57 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2025-08-07  1:54 UTC (permalink / raw)
  To: ast
  Cc: daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, mykolal, shuah, bpf,
	linux-kselftest, linux-kernel, Jiapeng Chong, Abaci Robot

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 <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=23403
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] selftests/bpf: Fix warning comparing pointer to 0
  2025-08-07  1:54 [PATCH -next] selftests/bpf: Fix warning comparing pointer to 0 Jiapeng Chong
@ 2025-08-07  1:57 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2025-08-07  1:57 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Mykola Lysenko,
	Shuah Khan, bpf, open list:KERNEL SELFTEST FRAMEWORK, LKML,
	Abaci Robot

On Wed, Aug 6, 2025 at 6:54 PM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> 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 <abaci@linux.alibaba.com>

Hey Abaci folks,

stop sending this kind of patches.
Use your time for actual useful work instead of noise like this.

--
pw-bot: cr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-07  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  1:54 [PATCH -next] selftests/bpf: Fix warning comparing pointer to 0 Jiapeng Chong
2025-08-07  1:57 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).