Re: [PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-16 Thread Kees Cook
On Tue, Jun 16, 2020 at 03:48:51PM -0500, Gustavo A. R. Silva wrote: > > > On 6/10/20 16:38, Kees Cook wrote: > > >> -#define struct_size(p, member, n) \ > >> - __ab_c_size(n, \ > >> +#define struct_size(p,

Re: [PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-16 Thread Gustavo A. R. Silva
On 6/10/20 16:38, Kees Cook wrote: >> -#define struct_size(p, member, n) \ >> -__ab_c_size(n, \ >> +#define struct_size(p, member, count) >> \ >> +

Re: [PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-10 Thread Kees Cook
On Mon, Jun 08, 2020 at 08:22:33PM -0500, Gustavo A. R. Silva wrote: > Add flex_array_size() helper for the calculation of the size, in bytes, > of a flexible array member contained within an enclosing structure. > > Example of usage: > > struct something { > size_t count; > struct

Re: [PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-09 Thread Kees Cook
On Mon, Jun 08, 2020 at 11:47:03PM -0700, Joe Perches wrote: > On Mon, 2020-06-08 at 20:22 -0500, Gustavo A. R. Silva wrote: > > Add flex_array_size() helper for the calculation of the size, in bytes, > > of a flexible array member contained within an enclosing structure. > [] > > diff --git

Re: [PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-09 Thread Joe Perches
On Mon, 2020-06-08 at 20:22 -0500, Gustavo A. R. Silva wrote: > Add flex_array_size() helper for the calculation of the size, in bytes, > of a flexible array member contained within an enclosing structure. [] > diff --git a/include/linux/overflow.h b/include/linux/overflow.h [] > +/** > + *

[PATCH v2] overflow.h: Add flex_array_size() helper

2020-06-08 Thread Gustavo A. R. Silva
Add flex_array_size() helper for the calculation of the size, in bytes, of a flexible array member contained within an enclosing structure. Example of usage: struct something { size_t count; struct foo items[]; }; struct something *instance; instance =