Re: Adjusting further size determinations?

From: SF Markus Elfring
Date: Wed Oct 18 2017 - 09:50:58 EST


>> If you want 'security' for kmalloc() then:
>>
>> #define KMALLOC_TYPE(flags) (type *)kmalloc(sizeof (type), flags)
>> #define KMALLOC(ptr, flags) *(ptr) = KMALLOC_TYPE(typeof *(ptr), flags)

Such an approach might help.


>> and change:
>> ptr = kmalloc(sizeof *ptr, flags);
>> to:
>> KMALLOC(&ptr, flags);
>>
>> But it is all churn for churn's sake.
>
> Please don't.

Interesting â


> Coccinelle won't find real problems with kmalloc any more if this is done.

The corresponding source code analysis will become different
(or more challenging) then. Are you still looking for related solutions?

Regards,
Markus