Re: [PATCH] md/raid5: missing error code in setup_conf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2022-07-19 03:48, Dan Carpenter wrote:
> Return -ENOMEM if the allocation fails.  Don't return success.
> 
> Fixes: 8fbcba6b999b ("md/raid5: Cleanup setup_conf() error returns")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Oops, nice catch. 

Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>

Thanks,

Logan

> ---
>  drivers/md/raid5.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index a7db73d36cc4..f31012357572 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux