]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf/x86/intel/bts: Replace offsetof() with struct_size()
authorThorsten Blum <thorsten.blum@linux.dev>
Sun, 13 Apr 2025 10:41:09 +0000 (12:41 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 13 Apr 2025 19:05:50 +0000 (21:05 +0200)
commit5c3627b6f0595f1ec27e6f5df903bd072e9b9136
treeb6077062e310ba46150e5aee35f2895fd7c4d7f9
parent1734d98fbcce343eafba16e18e3a3001b3e94ab5
perf/x86/intel/bts: Replace offsetof() with struct_size()

Use struct_size() to calculate the number of bytes to allocate for a new
bts_buffer. Compared to offsetof(), struct_size() provides additional
compile-time checks (e.g., __must_be_array()).

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250413104108.49142-2-thorsten.blum@linux.dev
arch/x86/events/intel/bts.c