2019-06-04 16:11:38 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2013-06-09 00:21:42 +08:00
|
|
|
/// Free of a structure field
|
|
|
|
///
|
|
|
|
// Confidence: High
|
2019-06-04 16:11:38 +08:00
|
|
|
// Copyright: (C) 2013 Julia Lawall, INRIA/LIP6.
|
2013-06-09 00:21:42 +08:00
|
|
|
// URL: http://coccinelle.lip6.fr/
|
|
|
|
// Comments:
|
2013-06-20 19:10:56 +08:00
|
|
|
// Options: --no-includes --include-headers
|
2013-06-09 00:21:42 +08:00
|
|
|
|
|
|
|
virtual org
|
|
|
|
virtual report
|
|
|
|
virtual context
|
|
|
|
|
|
|
|
@r depends on context || report || org @
|
|
|
|
expression e;
|
|
|
|
identifier f;
|
|
|
|
position p;
|
|
|
|
@@
|
|
|
|
|
2016-05-23 23:07:19 +08:00
|
|
|
(
|
2013-06-09 00:21:42 +08:00
|
|
|
* kfree@p(&e->f)
|
2016-05-23 23:07:19 +08:00
|
|
|
|
|
|
|
|
* kzfree@p(&e->f)
|
|
|
|
)
|
2013-06-09 00:21:42 +08:00
|
|
|
|
|
|
|
@script:python depends on org@
|
|
|
|
p << r.p;
|
|
|
|
@@
|
|
|
|
|
|
|
|
cocci.print_main("kfree",p)
|
|
|
|
|
|
|
|
@script:python depends on report@
|
|
|
|
p << r.p;
|
|
|
|
@@
|
|
|
|
|
2016-05-23 23:07:19 +08:00
|
|
|
msg = "ERROR: invalid free of structure field"
|
2013-06-09 00:21:42 +08:00
|
|
|
coccilib.report.print_report(p[0],msg)
|