[Cocci] [PATCH] Coccinelle: kzalloc-simple: Add more zero allocating functions
SF Markus Elfring
elfring at users.sourceforge.net
Tue Dec 26 18:39:07 CET 2017
> We already have zero memory allocator functions to set the memory to
> 0 value instead of manually setting it using memset.
Thanks for your extension of this script for the semantic patch language.
Will this update suggestion get any better chances than the approach
“Script to replace allocate and memset with zalloc functions”?
> +/// Use zeroing allocator rather than allocator followed by memset with 0
Do you find the shown function name list complete now?
Did you omit a name like “kvm_kvzalloc” intentionally?
How do you think about the possibility to analyse relevant source files for
functions with the mentioned property?
> +- x = kmalloc(E1,E2);
> ++ x = kzalloc(E1,E2);
You suggest to use another application for the SmPL disjunction.
How do you think about to refactor this specification a bit like the following?
+ x =
+ (E1, E2);
> +- x = (T *)kmalloc(E1,E2);
> + x = kzalloc(E1,E2);
Why do you find it appropriate to omit a cast at this place while it is
preserved at other places?
More information about the Cocci