md/raid5: missing error code in setup_conf()
Subsystems (2)
PATCH 1/1 md/raid5: missing error code in setup_conf()
Return -ENOMEM if the allocation fails. Don't return success.
Fixes 8fbcba6b999b ("md/raid5: Cleanup setup_conf() error returns")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/md/raid5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/raid5.c +3 -1
@@ -7492,7 +7492,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
Signature · 1 line
2.35.1
Quoted 4 lines · Dan Carpenter
Return
-ENOMEMif the allocation fails. Don't return success.Fixes 8fbcba6b999b ("md/raid5: Cleanup setup_conf() error returns")Signed-off-by Dan Carpenter <[email protected]>
Oops, nice catch.
Reviewed-by Logan Gunthorpe <[email protected]>
Thanks,
Logan
Quoted 19 lines
--- drivers/md/raid5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/md/raid5.c +3
-1@@ -7492,7 +7492,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
Quoted 4 lines · Logan Gunthorpe
On 2022-07-19 03:48, Dan Carpenter wrote:
Quoted 8 lines
Quoted 4 lines
Return
-ENOMEMif the allocation fails. Don't return success.Fixes 8fbcba6b999b ("md/raid5: Cleanup setup_conf() error returns")Signed-off-by Dan Carpenter <[email protected]>Oops, nice catch.
Reviewed-by Logan Gunthorpe <[email protected]>
Applied to md-fixes. Thanks!
Song