Skip to contentSkip to conversation

Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr")

PATCH New Jules Irenge 1 participant 1 message Sep 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr")

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.

---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
index 27760627370d..f798acd43a28 100644
@@ -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);
Signature · 1 line
2.35.1