Re: [PATCH v2] coccinelle: api: add kzfree script

From: Markus Elfring
Date: Fri Jun 05 2020 - 02:43:33 EST


> Check for memset()/memset_explicit() with 0 followed by
> kfree()/vfree()/kvfree().

Another software evolution will become interesting here.


> +/// memset_explicit with 0 followed by kfree

How do you think about to extend this comment?


Would you like to take the following SmPL code variants into account?


> +virtual context
> +virtual org
> +virtual report
> +virtual patch

+virtual context, org, report, patch


> +(
> +- kfree(E);
> ++ kzfree(E);
> +|
> +- vfree(E);
> ++ kvfree_sensitive(E, size);
> +|
> +- kvfree(E);
> ++ kvfree_sensitive(E, size);
> +)

+(
+-kfree
++kzfree
+ (E);
+|
+-vfree
++kvfree_sensitive
+ (E
++ , size
+ );
+|
+-kvfree
++kvfree_sensitive
+ (E
++ , size
+ );
+)


Regards,
Markus