]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm, slab: use kmem_cache_free() to free from kmem_buckets_cache
authorYan Zhen <yanzhen@vivo.com>
Thu, 22 Aug 2024 02:27:04 +0000 (10:27 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 27 Aug 2024 14:57:35 +0000 (16:57 +0200)
In kmem_buckets_create(), the kmem_buckets object is allocated by
kmem_cache_alloc() from kmem_buckets_cache, but in the failure case,
it's freed by kfree(). This is not wrong, but using kmem_cache_free()
is the more common pattern, so use it.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slab_common.c

index dea2b05c0e3f89be3a14061fd769fe3c07c360b2..ca694f5553b4e0138e2b8ecf5373711c107de913 100644 (file)
@@ -495,7 +495,7 @@ kmem_buckets *kmem_buckets_create(const char *name, slab_flags_t flags,
 fail:
        for (idx = 0; idx < ARRAY_SIZE(kmalloc_caches[KMALLOC_NORMAL]); idx++)
                kmem_cache_destroy((*b)[idx]);
-       kfree(b);
+       kmem_cache_free(kmem_buckets_cache, b);
 
        return NULL;
 }