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

2024-05-09 Thread Erick Archer
Hi Kees and Christophe, First of all, thanks for the reviews, comments and advices. On Mon, May 06, 2024 at 09:23:15AM -0700, Kees Cook wrote: > On Sun, May 05, 2024 at 07:31:24PM +0200, Erick Archer wrote: > > On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote: > > > Le

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

2024-05-06 Thread Christophe JAILLET
Le 06/05/2024 à 18:23, Kees Cook a écrit : On Sun, May 05, 2024 at 07:31:24PM +0200, Erick Archer wrote: On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote: Le 05/05/2024 à 16:15, Erick Archer a écrit : diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c

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

2024-05-06 Thread Kees Cook
On Sun, May 05, 2024 at 07:31:24PM +0200, Erick Archer wrote: > On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote: > > Le 05/05/2024 à 16:15, Erick Archer a écrit : > > > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > > > index 4013408ce012..080537eff69f

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

2024-05-05 Thread Erick Archer
On Sun, May 05, 2024 at 05:24:55PM +0200, Christophe JAILLET wrote: > Le 05/05/2024 à 16:15, Erick Archer a écrit : > > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > > index 4013408ce012..080537eff69f 100644 > > --- a/kernel/events/ring_buffer.c > > +++

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

2024-05-05 Thread Christophe JAILLET
Le 05/05/2024 à 16:15, Erick Archer a écrit : 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 {

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

2024-05-05 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[]; };