1 // SPDX-License-Identifier: GPL-2.0
2 /// Make sure calls to d_find_alias() have a corresponding call to dput().
4 // Keywords: d_find_alias, dput
6 // Confidence: Moderate
7 // URL: http://coccinelle.lip6.fr/
8 // Options: --include-headers
16 local idexpression struct dentry *dent;
22 if (!(dent@p1 = d_find_alias(...))) S1
24 dent@p1 = d_find_alias(...)
27 <...when != dput(dent)
28 when != if (...) { <+... dput(dent) ...+> }
29 when != true !dent || ...
35 return <+...dent...+>;
45 local idexpression struct dentry *r.dent;
57 @script:python depends on org@
61 cocci.print_main("Missing call to dput()",p1)
62 cocci.print_secs("",p2)
65 local idexpression struct dentry *r.dent;
76 @script:python depends on report@
80 msg = "Missing call to dput() at line %s."
81 coccilib.report.print_report(p1[0], msg % (p2[0].line))