Skip to content

Commit

Permalink
perf/x86: Annotate struct bts_buffer::buf with __counted_by()
Browse files Browse the repository at this point in the history
Add the __counted_by() compiler attribute to the flexible array member
buf to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250305123134.215577-2-thorsten.blum@linux.dev
  • Loading branch information
Thorsten Blum authored and Ingo Molnar committed Mar 5, 2025
1 parent da02f54 commit 5e7adc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/events/intel/bts.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct bts_buffer {
local_t head;
unsigned long end;
void **data_pages;
struct bts_phys buf[];
struct bts_phys buf[] __counted_by(nr_bufs);
};

static struct pmu bts_pmu;
Expand Down

0 comments on commit 5e7adc8

Please sign in to comment.