1 // Find cases where a pointer is dereferenced and then compared to NULL
4 // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2.
5 // URL: http://www.emn.fr/x-info/coccinelle/rules/null_ref.html
18 ... when != \(x = E1\|&x\)
23 ... when != \(x = E1\|&x\)
27 x != NULL && (<+...x->fld...+>)
29 x == NULL || (<+...x->fld...+>)
31 x != NULL ? (<+...x->fld...+>) : E
36 ... when != \(x = E\|&x\)
42 expression match.x, E1, E2;
43 position match.p1,match.p2;
51 ... when != \(x = E2\|&x\)
56 expression match.x, E2;
57 position match.p1,match.p2;
60 ... when != \(x = E2\|&x\)
64 @ script:python depends on !other_match && !other_match1 && org@
70 cocci.print_secs("NULL test",p2)
72 @depends on !other_match && !other_match1 && diff@
73 position match.p1, match.p2;