summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/free/kfreeaddr.cocci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 01:08:06 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 01:08:06 +0200
commitae9249493049fd41fa52fc0470251ee1efaabe74 (patch)
treecad8b206dda4caec111877a762f8f590702257de /scripts/coccinelle/free/kfreeaddr.cocci
parentMerge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmare... (diff)
parentCoccinelle: Update information about the minimal version required (diff)
downloadlinux-ae9249493049fd41fa52fc0470251ee1efaabe74.tar.xz
linux-ae9249493049fd41fa52fc0470251ee1efaabe74.zip
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull coccinelle updates from Michal Marek: "The misc branch is reserved for Coccinelle this time: - 'report' is the default mode - MAINTAINERS update for Coccinelle - documentation udate - use new option format for spatch(1) - J=<n> variable to mimic make -j for coccicheck - check for missing pci_free_consistent() calls There are some patches for rpm-pkg and deb-pkg waiting for the 3.12-rc1 merge window" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: Coccinelle: Update information about the minimal version required Coccinelle: Update the options used to the new option scheme scripts: Coccinelle script for pci_free_consistent() Coccinelle: Update the documentation Coccinelle: Update section of MAINTAINERS coccicheck: span checks across CPUs scripts/coccinelle: check for field address argument to kfree Coccinelle: Update the Coccinelle section of MAINTAINERS Coccinelle: Make 'report' the default mode
Diffstat (limited to 'scripts/coccinelle/free/kfreeaddr.cocci')
-rw-r--r--scripts/coccinelle/free/kfreeaddr.cocci32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/coccinelle/free/kfreeaddr.cocci b/scripts/coccinelle/free/kfreeaddr.cocci
new file mode 100644
index 000000000000..ce8aacc314cb
--- /dev/null
+++ b/scripts/coccinelle/free/kfreeaddr.cocci
@@ -0,0 +1,32 @@
+/// Free of a structure field
+///
+// Confidence: High
+// Copyright: (C) 2013 Julia Lawall, INRIA/LIP6. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Comments:
+// Options: --no-includes --include-headers
+
+virtual org
+virtual report
+virtual context
+
+@r depends on context || report || org @
+expression e;
+identifier f;
+position p;
+@@
+
+* kfree@p(&e->f)
+
+@script:python depends on org@
+p << r.p;
+@@
+
+cocci.print_main("kfree",p)
+
+@script:python depends on report@
+p << r.p;
+@@
+
+msg = "ERROR: kfree of structure field"
+coccilib.report.print_report(p[0],msg)