All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md/raid5: missing error code in setup_conf()
@ 2022-07-19  9:48 Dan Carpenter
  2022-07-19 16:57 ` Logan Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2022-07-19  9:48 UTC (permalink / raw)
  To: Song Liu, Logan Gunthorpe; +Cc: linux-raid, kernel-janitors

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@oracle.com>
---
 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
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] md/raid5: missing error code in setup_conf()
  2022-07-19  9:48 [PATCH] md/raid5: missing error code in setup_conf() Dan Carpenter
@ 2022-07-19 16:57 ` Logan Gunthorpe
  2022-07-19 18:41   ` Song Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Logan Gunthorpe @ 2022-07-19 16:57 UTC (permalink / raw)
  To: Dan Carpenter, Song Liu; +Cc: linux-raid, kernel-janitors



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@oracle.com>

Oops, nice catch. 

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] md/raid5: missing error code in setup_conf()
  2022-07-19 16:57 ` Logan Gunthorpe
@ 2022-07-19 18:41   ` Song Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Song Liu @ 2022-07-19 18:41 UTC (permalink / raw)
  To: Logan Gunthorpe; +Cc: Dan Carpenter, linux-raid, kernel-janitors

On Tue, Jul 19, 2022 at 9:57 AM Logan Gunthorpe <logang@deltatee.com> wrote:
>
>
>
> 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@oracle.com>
>
> Oops, nice catch.
>
> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Applied to md-fixes. Thanks!

Song

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-19 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19  9:48 [PATCH] md/raid5: missing error code in setup_conf() Dan Carpenter
2022-07-19 16:57 ` Logan Gunthorpe
2022-07-19 18:41   ` Song Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.