]> git.baikalelectronics.ru Git - kernel.git/commitdiff
md/raid5: missing error code in setup_conf()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 19 Jul 2022 09:48:01 +0000 (12:48 +0300)
committerSong Liu <song@kernel.org>
Tue, 19 Jul 2022 17:58:33 +0000 (10:58 -0700)
Return -ENOMEM if the allocation fails.  Don't return success.

Fixes: b322c93b54e4 ("md/raid5: Cleanup setup_conf() error returns")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/raid5.c

index 5d09256d7f81857d4a6861ef192a6f0d385118a8..96c3a1185781341861fede13b81ce51a7e020a5b 100644 (file)
@@ -7304,7 +7304,9 @@ static struct r5conf *setup_conf(struct mddev *mddev)
                goto abort;
        conf->mddev = mddev;
 
-       if ((conf->stripe_hashtbl = kzalloc(PAGE_SIZE, GFP_KERNEL)) == NULL)
+       ret = -ENOMEM;
+       conf->stripe_hashtbl = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       if (!conf->stripe_hashtbl)
                goto abort;
 
        /* We init hash_locks[0] separately to that it can be used