Re: [PATCH] mm: memcontrol: use struct_size() in kmalloc()

2019-01-10 Thread William Kucharski
> On Jan 4, 2019, at 11:37 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 fo

Re: [PATCH] mm: memcontrol: use struct_size() in kmalloc()

2019-01-08 Thread Michal Hocko
Cc Andrew (original patch is here http://lkml.kernel.org/r/20190104183726.GA6374@embeddedor) On Fri 04-01-19 12:37:26, 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 > wit

[PATCH] mm: memcontrol: use struct_size() in kmalloc()

2019-01-04 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 = kmalloc(sizeof(struct foo