Re: [PATCH] coccinelle: api: add kvfree script

From: Markus Elfring
Date: Sat Jun 06 2020 - 10:05:08 EST


> +@choice@
> +expression E, E1;
> +position kok, vok;
> +@@
> +
> +(
> + if (...) {
> + ...
> + E = \(kmalloc@kok\|â\)(...)

Further implementation details from this SmPL script caught my software
development attention.

* Is there a need to add the specification âwhen anyâ to the SmPL ellipses
before such assignment statements?

* A limited search approach was expressed. Will additional source code variations
become relevant?
+ switch statement
+ if branches with single statements
+ conditional operator


> +@opportunity depends on !patch â@
â
> + E = \(kmalloc\|â\)(..., size, ...)
> + ... when != E = E1
> + when != size = E1

I wonder that two assignments should be excluded here according to
the same expression metavariable.


+@pkfree depends on patch exists@
â
+- \(kfree\|kvfree\)(E)
++ vfree(E)

Would you like to use a SmPL code variant like the following
at any more places?
(Is it occasionally helpful to increase the change precision?)

+-\(kfree\|kvfree\)
++vfree
+ (E)


Regards,
Markus