coccinelle: api: extend memdup_user transformation with GFP_USER
Quoted 2 lines
Match
GFP_USERand optional__GFP_NOWARNallocations withmemdup_user.coccirule.
You suggest another interesting software extension.
…
Review
Quoted 10 lines
+++
b/scripts/coccinelle/api/memdup_user.cocci(quoted diff) +0
-0@@ -20,7 +20,9 @@ expression from,to,size; identifier l1,l2;@@
-- to = \(kmalloc\|kzalloc\)(size,GFP_KERNEL); +- to = \(kmalloc\|kzalloc\)(quoted diff) +2
-0+ (size,\(GFP_KERNEL\|GFP_USER\| + \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\)); + to = memdup_user(from,size);
But I find the proposed change for such SmPL code inappropriate.
It was specified by the means of the semantic patch language
to replace an assignment statement for which a function call provides a value. I would interpret your adjustment in the way that an expression list should be preserved.
Were two minus characters forgotten for the first SmPL rule?
Further concerns should be taken into account for the SmPL rule “r”.
I would appreciate if the clarification will be continued also for the topic “Safer source code analysis by "memdup_user.cocci"”?
https://github.com/coccinelle/coccinelle/issues/78
Regards,
Markus