]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/slab: remove duplicate check in create_cache()
authorZhen Lei <thunder.leizhen@huawei.com>
Wed, 9 Oct 2024 03:54:55 +0000 (11:54 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 29 Oct 2024 09:43:24 +0000 (10:43 +0100)
The WARN_ON() check in static function create_cache() is done by its only
parent __kmem_cache_create_args() before calling it.
if (... ||
    WARN_ON(... ||
    object_size - args->usersize < args->useroffset))
args->usersize = args->useroffset = 0;
...
s = create_cache(cache_name, object_size, args, flags);

Therefore, the WARN_ON() check in create_cache() can be safely removed.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slab_common.c

index f1f90491df03ae4c0d217cbfed5691220e891d8d..9e22d1266f6a2a6dce1883b66f4955018412fae2 100644 (file)
@@ -222,9 +222,6 @@ static struct kmem_cache *create_cache(const char *name,
        struct kmem_cache *s;
        int err;
 
-       if (WARN_ON(args->useroffset + args->usersize > object_size))
-               args->useroffset = args->usersize = 0;
-
        /* If a custom freelist pointer is requested make sure it's sane. */
        err = -EINVAL;
        if (args->use_freeptr_offset &&