char/tpm: Improve a size determination in nine functions
SF Markus Elfring
elfring at users.sourceforge.net
Wed Oct 18 05:41:04 AEDT 2017
>> p = kmalloc(sizeof(*p), ...);
>>
>> The alternative form where struct name is spelled out hurts readability and
>> introduces an opportunity for a bug when the pointer variable type is changed
>> but the corresponding sizeof that is passed to a memory allocator is not.
>
> True, thanks for the reminder.
Will it trigger further software development considerations (besides my contributions)?
> Is this common in new code?
Do you start an official survey here?
> Is there a script/ or some other automated way of catching this usage
Yes. - I am using an approach for the semantic patch language. ;-)
> before patches are upstreamed?
I imagine that a corresponding source code analysis variant could be applied
in more cases if sufficient acceptance could be achieved.
> Just as you're doing here, the patch description should reference this
> in the patch description.
Do you find my wording “This issue was detected by using the Coccinelle software.” insufficient?
Regards,
Markus
More information about the Linuxppc-dev
mailing list