Skip to content

Commit 5e7adc8

Browse files
tobluxIngo Molnar
authored andcommitted
perf/x86: Annotate struct bts_buffer::buf with __counted_by()
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent da02f54 commit 5e7adc8

File tree

1 file changed

+1
-1
lines changed
  • arch/x86/events/intel

1 file changed

+1
-1
lines changed

arch/x86/events/intel/bts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct bts_buffer {
5858
local_t head;
5959
unsigned long end;
6060
void **data_pages;
61-
struct bts_phys buf[];
61+
struct bts_phys buf[] __counted_by(nr_bufs);
6262
};
6363

6464
static struct pmu bts_pmu;

0 commit comments

Comments
 (0)