[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6ab7cfc8-7fc0-523a-70f6-a6701ad691b3@embeddedor.com>
Date: Mon, 24 Dec 2018 01:46:28 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Ido Schimmel <idosch@...sch.org>
Cc: Jiri Pirko <jiri@...lanox.com>, Ido Schimmel <idosch@...lanox.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mlxsw: spectrum_acl_bloom_filter: use struct_size() in
kzalloc()
On 12/24/18 1:38 AM, Ido Schimmel wrote:
> On Sun, Dec 23, 2018 at 11:27:41PM -0600, 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;
>> void *entry[];
>> };
>>
>> instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
>>
>> Instead of leaving these open-coded and prone to type mistakes, we can
>> now use the new struct_size() helper:
>>
>> instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
>>
>> This issue was detected with the help of Coccinelle.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
>
> Reviewed-by: Ido Schimmel <idosch@...lanox.com>
>
> But net-next is closed (http://vger.kernel.org/~davem/net-next.html) and
> this isn't a bug fix. Can you please re-submit when net-next opens
> again? Alternatively, I can apply the patch to my mlxsw queue and submit
> in your stead. Let me know what you prefer.
>
Oh yeah. I forgot net close net-next during the merge window. I'll
re-submit it in two weeks then. I'll add your Reviewed-by.
Happy holiday.
Thanks
--
Gustavo
Powered by blists - more mailing lists