RE: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-12 Thread Vincent Mailhol
[resend] I do not know why but below message got blocked for, I quote: Your message looked spammy to us. Please check https://subspace.kernel.org/etiquette.html and resend. And I have no clue which part I violated. Maybe it is the gmail web client? Resending with the git client, hoping this t

RE: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-11 Thread David Laight
... > > [1] Both the '+' and '*' have extra code to detect overflow and return > > a 'big' value that will cause kmalloc() to return NULL. > > I've not looked at the generated code but it is likely to be horrid > > (especially the check for multiply overflowing). > > In this case there are enou

RE: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-11 Thread David Laight
From: Vincent Mailhol > Sent: 10 September 2024 03:50 > > If the offsetof() of a given flexible array member (fam) is smaller > than the sizeof() of the containing struct, then the struct_size() > macro reports a size which is too big. > > This occurs when the two conditions below are met: > >

Re: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-10 Thread Vincent MAILHOL
On Wed. 11 Sep. 2024 at 09:36, Kees Cook wrote: > On Tue, Sep 10, 2024 at 11:49:52AM +0900, Vincent Mailhol wrote: > > If the offsetof() of a given flexible array member (fam) is smaller > > than the sizeof() of the containing struct, then the struct_size() > > macro reports a size which is too bi

Re: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-10 Thread Kees Cook
On Tue, Sep 10, 2024 at 11:49:52AM +0900, Vincent Mailhol wrote: > If the offsetof() of a given flexible array member (fam) is smaller > than the sizeof() of the containing struct, then the struct_size() > macro reports a size which is too big. > > This occurs when the two conditions below are met