1 /// PTR_ERR should access the value just tested by IS_ERR
2 //# There can be false positives in the patch case, where it is the call to
3 //# IS_ERR that is wrong.
6 // Copyright: (C) 2012, 2015 Julia Lawall, INRIA. GPLv2.
7 // Copyright: (C) 2012, 2015 Gilles Muller, INRIA. GPLv2.
8 // URL: http://coccinelle.lip6.fr/
9 // Options: --no-includes --include-headers
21 if (IS_ERR(x=e) || ...) {
32 if (IS_ERR(x) || ...) {
35 PTR_ERR@p(\(e1 ? e2 : x\|e1 ? x : e2\))
42 @r1 depends on patch && !context && !org && !report exists@
44 position p != {ok1.p,ok2.p};
47 if (IS_ERR(x) || ...) {
61 // ----------------------------------------------------------------------------
63 @r1_context depends on !patch && (context || org || report) exists@
64 position p != {ok1.p,ok2.p};
69 if (IS_ERR@j0(x) || ...) {
82 @r1_disj depends on !patch && (context || org || report) exists@
83 position p != {ok1.p,ok2.p};
85 position r1_context.j0, r1_context.j1;
88 * if (IS_ERR@j0(x) || ...) {
97 // ----------------------------------------------------------------------------
99 @script:python r1_org depends on org@
104 msg = "inconsistent IS_ERR and PTR_ERR"
105 coccilib.org.print_todo(j0[0], msg)
106 coccilib.org.print_link(j1[0], "")
108 // ----------------------------------------------------------------------------
110 @script:python r1_report depends on report@
115 msg = "inconsistent IS_ERR and PTR_ERR on line %s." % (j1[0].line)
116 coccilib.report.print_report(j0[0], msg)