* req: option to show area warning is from
@ 2026-01-07 14:58 Ben Dooks
2026-01-07 19:40 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2026-01-07 14:58 UTC (permalink / raw)
To: linux-sparse
I think it would be useful to have an option to show a more detailed
view of which part of the source generated a warning. Would this be
possible and if so is there anyone interested in doing it?
I'm looking at the following warning:
./include/trace/events/xdp.h:304:1: warning: Using plain integer as NULL
pointer
And the kernel source from the pre-processed file looks like this:
> static __attribute__((no_instrument_function)) void do_perf_trace_mem_disconnect(void *__data, const struct xdp_mem_allocator *xa) { struct trace_event_call *event_call = __data; struct trace_event_data_offsets_mem_disconnect __attribute__((__unused__)) __data_offsets; struct trace_event_raw_mem_disconnect *entry; struct pt_regs *__regs; u64 __count = 1; struct task_struct *__task = ((void *)0); struct hlist_head *head; int __entry_size; int __data_size; int rctx; __data_size = trace_event_get_offsets_mem_disconnect(&__data_offsets, xa); head = ({ do { const void __seg_gs *__vpp_verify = (typeof((event_call->perf_events) + 0))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long tcp_ptr__ = ({ *( typeof(this_cpu_off) *)(&(this_cpu_off)); }); tcp_ptr__ += ( unsigned long)(event_call->perf_events); (__typeof_unqual__(*(event_call->perf_events)) *)tcp_ptr__; }); }); if (!bpf_prog_array_valid(event_call) && __builtin_constant_p(!__task) && !__task && hlist_empty(head)) return; __entry_size = ((((__data_size + sizeof(*entry) + sizeof(u32))) + ((__typeof__((__data_size + sizeof(*entry) + sizeof(u32))))((sizeof(u64))) - 1)) & ~((__typeof__((__data_size + sizeof(*entry) + sizeof(u32))))((sizeof(u64))) - 1)); __entry_size -= sizeof(u32); entry = perf_trace_buf_alloc(__entry_size, &__regs, &rctx); if (!entry) return; perf_fetch_caller_regs(__regs); { entry->xa = xa; entry->mem_id = xa->mem.id; entry->mem_type = xa->mem.type; entry->allocator = xa->allocator;; } perf_trace_run_bpf_submit(entry, __entry_size, rctx, event_call, __count, __regs, head, __task); } static __attribute__((no_instrument_function)) void perf_trace_mem_disconnect(void *__data, const struct xdp_mem_allocator *xa) { u64 __count __attribute__((unused)); struct task_struct *__task __attribute__((unused)); do_perf_trace_mem_disconnect(__data, xa); }; static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) void perf_test_probe_mem_disconnect(void) { check_trace_callback_type_mem_disconnect(perf_trace_mem_disconnect); };
This is obviously a lot to go through and very difficult to read.
It would be great if we could get a dump of what was going on.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: req: option to show area warning is from
2026-01-07 14:58 req: option to show area warning is from Ben Dooks
@ 2026-01-07 19:40 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-01-07 19:40 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-sparse
On Wed, Jan 07, 2026 at 02:58:44PM +0000, Ben Dooks wrote:
> I think it would be useful to have an option to show a more detailed
> view of which part of the source generated a warning. Would this be
> possible and if so is there anyone interested in doing it?
>
> I'm looking at the following warning:
> ./include/trace/events/xdp.h:304:1: warning: Using plain integer as NULL
> pointer
>
> And the kernel source from the pre-processed file looks like this:
>
> > static __attribute__((no_instrument_function)) void do_perf_trace_mem_disconnect(void *__data, const struct xdp_mem_allocator *xa) { struct trace_event_call *event_call = __data; struct trace_event_data_offsets_mem_disconnect __attribute__((__unused__)) __data_offsets; struct trace_event_raw_mem_disconnect *entry; struct pt_regs *__regs; u64 __count = 1; struct task_struct *__task = ((void *)0); struct hlist_head *head; int __entry_size; int __data_size; int rctx; __data_size = trace_event_get_offsets_mem_disconnect(&__data_offsets, xa); head = ({ do { const void __seg_gs *__vpp_verify = (typeof((event_call->perf_events) + 0))((void *)0); (void)__vpp_verify; } while (0); ({ unsigned long tcp_ptr__ = ({ *( typeof(this_cpu_off) *)(&(this_cpu_off)); }); tcp_ptr__ += ( unsigned long)(event_call->perf_events); (__typeof_unqual__(*(event_call->perf_events)) *)tcp_ptr__; }); }); if (!bpf_prog_array_valid(event_call) && __builtin_constant_p(!__task) && !__task && hlist_empty(head)) return; __entry_size = ((((__data_size + sizeof(*entry) + sizeof(u32))) + ((__typeof__((__data_size + sizeof(*entry) + sizeof(u32))))((sizeof(u64))) - 1)) & ~((__typeof__((__data_size + sizeof(*entry) + sizeof(u32))))((sizeof(u64))) - 1)); __entry_size -= sizeof(u32); entry = perf_trace_buf_alloc(__entry_size, &__regs, &rctx); if (!entry) return; perf_fetch_caller_regs(__regs); { entry->xa = xa; entry->mem_id = xa->mem.id; entry->mem_type = xa->mem.type; entry->allocator = xa->allocator;; } perf_trace_run_bpf_submit(entry, __entry_size, rctx, event_call, __count, __regs, head, __task); } static __attribute__((no_instrument_function)) void perf_trace_mem_disconnect(void *__data, const struct xdp_mem_allocator *xa) { u64 __count __attribute__((unused)); struct task_struct *__task __attribute__((unused)); do_perf_trace_mem_disconnect(__data, xa); }; static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) void perf_test_probe_mem_disconnect(void) { check_trace_callback_type_mem_disconnect(perf_trace_mem_disconnect); };
>
>
> This is obviously a lot to go through and very difficult to read.
>
> It would be great if we could get a dump of what was going on.
Yeah, I spend a lot of time adding newlines to pre-processed code. Is
there a good script to re-indent .i files?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-07 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 14:58 req: option to show area warning is from Ben Dooks
2026-01-07 19:40 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox