bpf: fix dump_stack() type cast
PATCH 1/1 bpf: fix dump_stack() type cast
From: Arnd Bergmann <[email protected]>
Passing a pointer as a 'u64' variable requires a double cast when converting it back to a pointer:
kernel/bpf/stream.c: In function 'dump_stack_cb':kernel/bpf/stream.c:505:64: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
505 | ctxp->err = bpf_stream_stage_printk(ctxp->ss, "%pS\n", (void *)ip);
| ^
--- kernel/bpf/stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/stream.c +2 -2
@@ -498,11 +498,11 @@ static bool dump_stack_cb(void *cookie, u64 ip, u64 sp, u64 bp)if (ret <0 ) goto end; ctxp->err =bpf_stream_stage_printk (ctxp->ss,"%pS\n %s @ %s:%d\n" , - (void *)ip, line, file, num); + (void *)(uintptr_t )ip, line, file, num);return !ctxp->err; } end: - ctxp->err =bpf_stream_stage_printk (ctxp->ss,"%pS\n" , (void *)ip); + ctxp->err =bpf_stream_stage_printk (ctxp->ss,"%pS\n" , (void *)(uintptr_t )ip);return !ctxp->err; }
Signature · 1 line
2.39.5
Eduard Zingerman
maintainerQuoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Passing a pointer as a 'u64' variable requires a double cast when converting it back to a pointer:
Quoted 8 lines
kernel/bpf/stream.c: In function 'dump_stack_cb':kernel/bpf/stream.c:505:64: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
505 |ctxp->err=bpf_stream_stage_printk(ctxp->ss, "%pS\n", (void *)ip);
| ^Fixes d7c431cafcb4 ("bpf: Add dump_stack() analogue to print to BPF stderr")Signed-off-by Arnd Bergmann <[email protected]>---
This warning is already fixed inbfa2bb9abd99be ("bpf: Fix improper int-to-ptr cast in dump_stack_cb"), which landed in bpf-next yesterday.
[...]