Re: [PATCH][next] Bluetooth: a2mp: Use struct_size() helper

2019-02-18 Thread Gustavo A. R. Silva
On 2/18/19 7:02 AM, Marcel Holtmann wrote: > Hi Gustavo, > >> 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

Re: [PATCH][next] Bluetooth: a2mp: Use struct_size() helper

2019-02-18 Thread Marcel Holtmann
Hi Gustavo, > 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[]; > }; > >

Re: [PATCH][next] Bluetooth: a2mp: Use struct_size() helper

2019-02-07 Thread Gustavo A. R. Silva
On 2/7/19 10:00 PM, Joe Perches wrote: > On Thu, 2019-02-07 at 18:28 -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

Re: [PATCH][next] Bluetooth: a2mp: Use struct_size() helper

2019-02-07 Thread Joe Perches
On Thu, 2019-02-07 at 18:28 -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][next] Bluetooth: a2mp: Use struct_size() helper

2019-02-07 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[]; }; size = sizeof(struct foo) +