Hi Gustavo,
On 21 February 2019 17:57, Gustavo A. R. Silva wrote:
> Subject: [PATCH] regulator: da9063: Use struct_size() in devm_kzalloc()
>
> 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) + count * sizeof(struct boo);
> instance = alloc(size, GFP_KERNEL)
>
> Instead of leaving these open-coded and prone to type mistakes, we can
> now use the new struct_size() helper:
Acked-by: Steve Twiss <[email protected]>
Thanks,
Regards,
Steve