req: option to show area warning is from
Ben Dooks <[email protected]> Wed, 7 Jan 2026 14:58:44 +0000
| Newsgroups | org.kernel.vger.linux-sparse |
|---|---|
| Organization | Codethink Limited. |
| Message-ID | <[email protected]> |
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