mm/slab_common.c: use kmem_cache_free()
authorVaishali Thakkar <vthakkar1994@gmail.com>
Tue, 10 Feb 2015 22:09:40 +0000 (14:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Feb 2015 22:30:30 +0000 (14:30 -0800)
Here, free memory is allocated using kmem_cache_zalloc.  So, use
kmem_cache_free instead of kfree.

This is done using Coccinelle and semantic patch used
is as follows:

@@
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)

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab_common.c

index e03dd6f2a27212768fb3f623115cea9f3579a06a..67f182c10f24d230a7ed8245bdfa813a99c067d2 100644 (file)
@@ -331,7 +331,7 @@ out:
 
 out_free_cache:
        memcg_free_cache_params(s);
-       kfree(s);
+       kmem_cache_free(kmem_cache, s);
        goto out;
 }