Re: [PATCH net-next] nfp: use struct_size() in kzalloc()

2019-02-01 Thread David Miller
From: "Gustavo A. R. Silva" Date: Wed, 30 Jan 2019 18:38:59 -0600 > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct fo

Re: [PATCH net-next] nfp: use struct_size() in kzalloc()

2019-01-31 Thread Joe Perches
On Wed, 2019-01-30 at 18:38 -0600, Gustavo A. R. Silva wrote: > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct foo { >

Re: [PATCH net-next] nfp: use struct_size() in kzalloc()

2019-01-31 Thread Gustavo A. R. Silva
Hi Joe, On 1/31/19 11:11 AM, Joe Perches wrote: > On Wed, 2019-01-30 at 18:38 -0600, Gustavo A. R. Silva wrote: >> One of the more common cases of allocation size calculations is finding >> the size of a structure that has a zero-sized array at the end, along >> with memory for some number of elem

Re: [PATCH net-next] nfp: use struct_size() in kzalloc()

2019-01-30 Thread Gustavo A. R. Silva
On 1/30/19 6:52 PM, Jakub Kicinski wrote: > On Wed, 30 Jan 2019 18:38:59 -0600, Gustavo A. R. Silva wrote: >> One of the more common cases of allocation size calculations is finding >> the size of a structure that has a zero-sized array at the end, along >> with memory for some number of element

Re: [PATCH net-next] nfp: use struct_size() in kzalloc()

2019-01-30 Thread Jakub Kicinski
On Wed, 30 Jan 2019 18:38:59 -0600, Gustavo A. R. Silva wrote: > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct foo { >

[PATCH net-next] nfp: use struct_size() in kzalloc()

2019-01-30 Thread Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; instance = kzalloc(sizeof(struc