Re: [PATCH] cpufreq: e_powersaver: Use struct_size() in kzalloc()

2019-01-24 Thread Gustavo A. R. Silva
On 1/24/19 4:34 AM, Rafael J. Wysocki wrote: > On Tuesday, January 8, 2019 6:00:56 AM CET Viresh Kumar wrote: >> On 07-01-19, 11:33, 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 t

Re: [PATCH] cpufreq: e_powersaver: Use struct_size() in kzalloc()

2019-01-24 Thread Rafael J. Wysocki
On Tuesday, January 8, 2019 6:00:56 AM CET Viresh Kumar wrote: > On 07-01-19, 11:33, 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

Re: [PATCH] cpufreq: e_powersaver: Use struct_size() in kzalloc()

2019-01-07 Thread Viresh Kumar
On 07-01-19, 11:33, 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 { > int stuff;

[PATCH] cpufreq: e_powersaver: Use struct_size() in kzalloc()

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