Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /// Free of a structure field
0003 ///
0004 // Confidence: High
0005 // Copyright: (C) 2013 Julia Lawall, INRIA/LIP6.
0006 // URL: https://coccinelle.gitlabpages.inria.fr/website
0007 // Comments:
0008 // Options: --no-includes --include-headers
0009 
0010 virtual org
0011 virtual report
0012 virtual context
0013 
0014 @r depends on context || report || org @
0015 expression e;
0016 identifier f;
0017 position p;
0018 @@
0019 
0020 (
0021 * kfree@p(&e->f)
0022 |
0023 * kfree_sensitive@p(&e->f)
0024 )
0025 
0026 @script:python depends on org@
0027 p << r.p;
0028 @@
0029 
0030 cocci.print_main("kfree",p)
0031 
0032 @script:python depends on report@
0033 p << r.p;
0034 @@
0035 
0036 msg = "ERROR: invalid free of structure field"
0037 coccilib.report.print_report(p[0],msg)