Re: [tip: perf/core] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
On 5. Mar 2025, at 12:02, Ingo Molnar wrote: > * Thorsten Blum wrote: >> On 5. Mar 2025, at 10:18, Ingo Molnar wrote: >>> Actually, on a second thought: >>> - buf = kzalloc_node(offsetof(struct bts_buffer, buf[nbuf]), GFP_KERNEL, node); + buf = kzalloc_node(struct_size(buf, buf, n

Re: [tip: perf/core] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Ingo Molnar
* Thorsten Blum wrote: > On 5. Mar 2025, at 10:18, Ingo Molnar wrote: > > Actually, on a second thought: > > > >> - buf = kzalloc_node(offsetof(struct bts_buffer, buf[nbuf]), GFP_KERNEL, > >> node); > >> + buf = kzalloc_node(struct_size(buf, buf, nbuf), GFP_KERNEL, node); > > > > Firstly, in

Re: [tip: perf/core] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
On 5. Mar 2025, at 10:18, Ingo Molnar wrote: > Actually, on a second thought: > >> - buf = kzalloc_node(offsetof(struct bts_buffer, buf[nbuf]), GFP_KERNEL, >> node); >> + buf = kzalloc_node(struct_size(buf, buf, nbuf), GFP_KERNEL, node); > > Firstly, in what world is 'buf, buf' more readable? On