Re: [PATCH v3] perf/ring_buffer: Prefer struct_size over open coded arithmetic

2024-05-13 Thread Kees Cook
On Sat, May 11, 2024 at 03:24:37PM +0200, Erick Archer wrote: > This is an effort to get rid of all multiplications from allocation > functions in order to prevent integer overflows [1][2]. > > As the "rb" variable is a pointer to "struct perf_buffer" and this > structure ends in a flexible

[PATCH v3] perf/ring_buffer: Prefer struct_size over open coded arithmetic

2024-05-11 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. As the "rb" variable is a pointer to "struct perf_buffer" and this structure ends in a flexible array: struct perf_buffer { [...] void*data_pages[]; };