> Now I wonder why the first assignment is not marked together with the 
> function call
> for further considerations by my source code analysis approach so far.

I should have adjusted one of the used regular expressions a bit more like the 
following.


@find_too_late_checking@
expression ex1, ex2;
identifier action1 =~ "^(?x)
(?:
   kzalloc
|  kmalloc_array
)$",
           action2 =~ "^(?x)
(?:
   kzalloc
|  kmalloc(?:_array)?
)$",
           work;
type return_type;
@@
 return_type work(...)
 {
 ... when any
*ex1 = action1(...);
 ex2 = action2(...);
 ... when any
 }


elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch.opt 
show_too_late_checking2.cocci ../Probe/clk-mstp-excerpt1.c
init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
HANDLING: ../Probe/clk-mstp-excerpt1.c
diff = 
--- ../Probe/clk-mstp-excerpt1.c
+++ /tmp/cocci-output-20109-52f048-clk-mstp-excerpt1.c
@@ -5,7 +5,6 @@ static void __init cpg_mstp_clocks_init(
        struct clk **clks;
        unsigned int i;
 
-       group = kzalloc(sizeof(*group), GFP_KERNEL);
        clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
        if (group == NULL || clks == NULL) {
                kfree(group);


I imagine that there are further software improvements to consider around
such use cases.

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to