Skip to contentSkip to conversation

check for get/put_cpu() imbalances

PATCH New Thomas Meyer 1 participant 1 message Aug 21, 2011 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check for get/put_cpu() imbalances

From: Thomas Meyer <[email protected]>

Semantic patch that checks if every get_cpu() has a corresponding put_cpu().

---
 scripts/coccinelle/misc/getput_cpu.cocci |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 scripts/coccinelle/misc/getput_cpu.cocci
scripts/coccinelle/misc/getput_cpu.cocci new file +24 -0
new file mode 100644
index 0000000..8f76153
@@ -0,0 +1,24 @@
+/// Check for get/put_cpu() imbalances
+///
+// Confidence: Low
+// Copyright: (C) 2011 Thomas Meyer
+// URL:
+// Comments:
+// Options: -no_includes -include_headers
+
+virtual report
+
+@r1 depends on report@
+position p;
+@@
+
+* get_cpu()@p
+... when != put_cpu()
+? get_cpu()
+
+@script:python depends on report@
+p << r1.p;
+@@
+
+msg="WARNING: Possible missing put_cpu()!"
+coccilib.report.print_report(p[0], msg)
Signature · 1 line
1.7.6