[Cocci] Coccinelle: kzalloc-simple: Add more zero allocating functions

SF Markus Elfring elfring at users.sourceforge.net
Wed Dec 27 11:17:57 CET 2017


>>> The cast is useful when it is to a non-pointer type.
>>
>> Will it be needed then to use an other metavariable for the assignment target?
>>
>> How much would you like to distinguish if an item should handle a pointer
>> (or not)?
> 
> The compiler will complain about an assignment between an integer and a pointer,

This tool distinguishes data types better.


> so one can assume that if the code is
> 
> x = (T *)kmalloc();
> 
> then x has pointer type.

We “hope” so.

How do you think about restrict the type for an acceptable target expression?


> If it doesn't have type T *, it doesn't matter.

I have got an other opinion for the corresponding specification in SmPL scripts.
I would prefer to avoid another bit of logical confusion.

Regards,
Markus


More information about the Cocci mailing list