summaryrefslogtreecommitdiff
path: root/scripts/coccinelle/free/ifnullfree.cocci
diff options
context:
space:
mode:
authorYann Droneaud <ydroneaud@opteya.com>2016-05-23 18:07:19 +0300
committerMichal Marek <mmarek@suse.com>2016-06-21 12:43:32 +0300
commit6dd9379e8f327e70d182b15be3ba21aa2b5d2cba (patch)
tree0e8d95f8e1748444490f8be79ba1b2dd7bde6553 /scripts/coccinelle/free/ifnullfree.cocci
parent7a2358b3818691521c7df531415d1ea4d0398520 (diff)
downloadlinux-6dd9379e8f327e70d182b15be3ba21aa2b5d2cba.tar.xz
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 <hannes@cmpxchg.org> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/coccinelle/free/ifnullfree.cocci')
-rw-r--r--scripts/coccinelle/free/ifnullfree.cocci4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
index 52bd235286fa..14a4cd98e83b 100644
--- a/scripts/coccinelle/free/ifnullfree.cocci
+++ b/scripts/coccinelle/free/ifnullfree.cocci
@@ -20,6 +20,8 @@ expression E;
(
kfree(E);
|
+ kzfree(E);
+|
debugfs_remove(E);
|
debugfs_remove_recursive(E);
@@ -39,7 +41,7 @@ position p;
@@
* if (E != NULL)
-* \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
+* \(kfree@p\|kzfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
* usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
* dma_pool_destroy@p\)(E);