[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <VI1PR10MB23520F07E8CBE05C0483698EFE7A0@VI1PR10MB2352.EURPRD10.PROD.OUTLOOK.COM>
Date: Mon, 25 Feb 2019 13:12:58 +0000
From: Steve Twiss <stwiss.opensource@...semi.com>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Support Opensource <Support.Opensource@...semi.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] regulator: da9063: Use struct_size() in devm_kzalloc()
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 <stwiss.opensource@...semi.com>
Thanks,
Regards,
Steve
Powered by blists - more mailing lists