kernel/cred.c: use kmem_cache_free
commite06fbe9a4092960a1db1fa973c9ec13a3ddce3f9
authorJulia Lawall <julia@diku.dk>
Tue, 2 Feb 2010 22:31:36 +0000 (3 09:31 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 9 Feb 2010 12:51:01 +0000 (9 04:51 -0800)
tree5c875bb5acd3a2c1cdcd7bfb736df61420a7d10c
parent35cfb03de1dcd87f405db30a9da65bd63bfa59fe
kernel/cred.c: use kmem_cache_free

commit b8a1d37c5f981cdd2e83c9fd98198832324cd57a upstream.

Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather
than kfree.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E,c;
@@

 x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...)
 ... when != x = E
     when != &x
?-kfree(x)
+kmem_cache_free(c,x)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: Steve Dickson <steved@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/cred.c