public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr")
@ 2022-09-04 10:18 Jules Irenge
  0 siblings, 0 replies; 4+ messages in thread
From: Jules Irenge @ 2022-09-04 10:18 UTC (permalink / raw)
  To: ast
  Cc: memxor, john.fastabend, andrii, daniel, martin.lau, bpf,
	inux-kernel, Elana.Copperman, jbi.octave

This patch fixes a warning generated by Sparse

"warning: Using plain integer as NULL pointer"

by replacing p with *p in the WRITE_ONCE() macro

This enables the pointer to be cleared on map value delete,
hence clearing the warning.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 27760627370d..f798acd43a28 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -598,7 +598,7 @@ void bpf_map_free_kptrs(struct bpf_map *map, void *map_value)
 		if (off_desc->type == BPF_KPTR_UNREF) {
 			u64 *p = (u64 *)btf_id_ptr;
 
-			WRITE_ONCE(p, 0);
+			WRITE_ONCE(*p, 0);
 			continue;
 		}
 		old_ptr = xchg(btf_id_ptr, 0);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH bpf-next] Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr")
@ 2022-09-04 10:28 Jules Irenge
  2022-09-04 21:10 ` Kumar Kartikeya Dwivedi
  2022-09-07 18:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Jules Irenge @ 2022-09-04 10:28 UTC (permalink / raw)
  To: ast; +Cc: memxor, linux-kernel, bpf, daniel, martin.lau, Elana.Copperman

This patch fixes a warning generated by Sparse

"warning: Using plain integer as NULL pointer"

by replacing p with *p in the WRITE_ONCE() macro

This enables the pointer to be cleared on map value delete,
hence clearing the warning.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 27760627370d..f798acd43a28 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -598,7 +598,7 @@ void bpf_map_free_kptrs(struct bpf_map *map, void *map_value)
 		if (off_desc->type == BPF_KPTR_UNREF) {
 			u64 *p = (u64 *)btf_id_ptr;
 
-			WRITE_ONCE(p, 0);
+			WRITE_ONCE(*p, 0);
 			continue;
 		}
 		old_ptr = xchg(btf_id_ptr, 0);
-- 
2.35.1


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

end of thread, other threads:[~2022-09-07 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-04 10:18 [PATCH bpf-next] Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr") Jules Irenge
  -- strict thread matches above, loose matches on Subject: below --
2022-09-04 10:28 Jules Irenge
2022-09-04 21:10 ` Kumar Kartikeya Dwivedi
2022-09-07 18:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox