Re: [PATCH] drm/rockchip: Use struct_size() in devm_kzalloc()

2018-08-29 Thread Heiko Stuebner
Am Sonntag, 26. August 2018, 20:47:12 CEST schrieb 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: > > struc

Re: [PATCH] drm/rockchip: Use struct_size() in devm_kzalloc()

2018-08-27 Thread Kees Cook
On Sun, Aug 26, 2018 at 11:47 AM, 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] drm/rockchip: Use struct_size() in devm_kzalloc()

2018-08-27 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 = devm_kzalloc(dev,