Skip to content

Commit 7c4da06

Browse files
v-thakkartorvalds
authored andcommitted
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 <[email protected]> Acked-by: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Acked-by: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 94e4d71 commit 7c4da06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/slab_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ do_kmem_cache_create(char *name, size_t object_size, size_t size, size_t align,
331331

332332
out_free_cache:
333333
memcg_free_cache_params(s);
334-
kfree(s);
334+
kmem_cache_free(kmem_cache, s);
335335
goto out;
336336
}
337337

0 commit comments

Comments
 (0)