[PATCH] drm/vc4: Use struct_size() in kzalloc()

2019-01-31 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; void *entry[]; }; instance = kzalloc(sizeof(struct foo

Re: [PATCH] drm/vc4: Use struct_size() in kzalloc()

2019-02-07 Thread Eric Anholt
"Gustavo A. R. Silva" writes: > 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; > void *entr

Re: [PATCH] drm/vc4: Use struct_size() in kzalloc()

2019-02-08 Thread Gustavo A. R. Silva
On 2/7/19 4:59 PM, Eric Anholt wrote: > "Gustavo A. R. Silva" writes: > >> 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: >>