Thread (88 messages) 88 messages, 13 authors, 2017-10-23

Re: char/tpm: Improve a size determination in nine functions

From: SF Markus Elfring <hidden>
Date: 2017-10-17 18:41:37
Also in: kernel-janitors, linux-integrity, lkml

quoted
	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help