From: Vaishali Thakkar Date: Tue, 10 Feb 2015 22:09:40 +0000 (-0800) Subject: mm/slab_common.c: use kmem_cache_free() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c4da061f2e953df479b126b9263f0e845bce0ec;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git mm/slab_common.c: use kmem_cache_free() 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 Acked-by: Christoph Lameter Cc: Pekka Enberg Acked-by: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab_common.c b/mm/slab_common.c index e03dd6f2a272..67f182c10f24 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -331,7 +331,7 @@ out: out_free_cache: memcg_free_cache_params(s); - kfree(s); + kmem_cache_free(kmem_cache, s); goto out; }