From 6dd9379e8f327e70d182b15be3ba21aa2b5d2cba Mon Sep 17 00:00:00 2001 From: Yann Droneaud Date: Mon, 23 May 2016 17:07:19 +0200 Subject: coccinelle: also catch kzfree() issues Since commit 3ef0e5ba4673 ('slab: introduce kzfree()'), kfree() is no more the only function to be considered: kzfree() should be recognized too. In particular, kzfree() must not be called on memory allocated through devm_*() functions. Cc: Johannes Weiner Acked-by: Julia Lawall Signed-off-by: Yann Droneaud Signed-off-by: Michal Marek --- scripts/coccinelle/free/kfreeaddr.cocci | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts/coccinelle/free/kfreeaddr.cocci') diff --git a/scripts/coccinelle/free/kfreeaddr.cocci b/scripts/coccinelle/free/kfreeaddr.cocci index ce8aacc314cb..d46063b1db8b 100644 --- a/scripts/coccinelle/free/kfreeaddr.cocci +++ b/scripts/coccinelle/free/kfreeaddr.cocci @@ -16,7 +16,11 @@ identifier f; position p; @@ +( * kfree@p(&e->f) +| +* kzfree@p(&e->f) +) @script:python depends on org@ p << r.p; @@ -28,5 +32,5 @@ cocci.print_main("kfree",p) p << r.p; @@ -msg = "ERROR: kfree of structure field" +msg = "ERROR: invalid free of structure field" coccilib.report.print_report(p[0],msg) -- cgit v1.2.3