On 8/23/18 3:56 PM, Kees Cook wrote:

>>
>> -       clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2),
>> -                          GFP_KERNEL);
>> +       clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL);
>>         if (!clk_data) {
>>                 kfree(rtc);
>>                 return;
> 
> This looks like entirely correct to me, but I'm surprised the
> Coccinelle script didn't discover this. I guess the isomorphisms don't
> cover the parenthesis?
> 

Apparently.

If I manually remove the ()s, the cocci script successfully generates a patch.

--
Gustavo

Reply via email to