1 /// Find a use after free.
2 //# Values of variables may imply that some
3 //# execution paths are not possible, resulting in false positives.
4 //# Another source of false positives are macros
5 //# that do not actually evaluate their argument
7 // Confidence: Moderate
8 // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
9 // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
10 // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
11 // URL: http://coccinelle.lip6.fr/
13 // Options: -no_includes -include_headers -D report
15 // Applies to kernel code.
25 \(contigfree@p1(E,...)\|kfree@p1(E,...)\|objcache_put@p1(...,E)\|mpipe_free@p1(...,E)\|zfree@p1(...,E)\)
36 f(...,c,...,(T)E@p,...)
61 \(contigfree@ok(E,...)\|kfree@ok(E,...)\|objcache_put@ok(...,E)\|mpipe_free@ok(...,E)\|zfree@ok(...,E)\)
68 expression free.E, subE<=free.E, E2;
72 position free.p1!=loop.ok,p2!={print.p,sz.p};
75 \(contigfree@p1(E,...)\|kfree@p1(E,...)\|objcache_put@p1(...,E)\|mpipe_free@p1(...,E)\|zfree@p1(...,E)\)
78 iter(...,subE,...) S // no use
80 list_remove_head(E1,subE,...)
96 return_ACPI_STATUS(...)
101 @script:python depends on org@
106 cocci.print_main("kfree",p1)
107 cocci.print_secs("ref",p2)
109 @script:python depends on report@
114 msg = "reference preceded by free on line %s" % (p1[0].line)
115 coccilib.report.print_report(p2[0],msg)