Hello,
I wanted to point out a couple of issues with your mini_null_ref2.cocci example.
The first is that it is lacking a test:
--- mini_null_ref2-2.cocci 2010-11-03 22:33:39.059472002 +0100
+++ mini_null_ref2.cocci 2010-11-03 22:35:16.529472002 +0100
@@ -9,13 +9,14 @@
@@
expression E,E1;
-identifier f,f1,fld,fld1;
+identifier f,fld,fld1;
statement S1,S2;
@@
E->fld = f(...);
... when != E = E1
when != E->fld1 = E1
+ when != f1(&E)
if (
- E
+ E->fld
although that should also allow and number of arguments to f1 before and after
&E,
I just don't know the right coccinelle syntax. The second point is that the
suggested
fix is only one possible case - it may just be that someone is being too
careful and
testing for NULL although it is not needed. So the script should probably do a
printf rather than suggesting a correction.
Regards,
Michael
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)