Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730531

Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
Date 2017-09-11 22:20 +0200
Message-ID <uoDlv-87V-9@gated-at.bofh.it> (permalink)
References <uoCSt-7IE-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon 11-09-17 21:43:23, Christophe JAILLET wrote:
> If the 'kmalloc' fails, we must go through the existing error handling
> path.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  mm/backing-dev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index f028a9a472fd..e19606bb41a0 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -569,8 +569,10 @@ static int cgwb_create(struct backing_dev_info *bdi,
>  
>  	/* need to create a new one */
>  	wb = kmalloc(sizeof(*wb), gfp);
> -	if (!wb)
> -		return -ENOMEM;
> +	if (!wb) {
> +		ret = -ENOMEM;
> +		goto out_put;
> +	}
>  
>  	ret = wb_init(wb, bdi, blkcg_css->id, gfp);
>  	if (ret)
> -- 
> 2.11.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-11 21:50 +0200
  Re: [PATCH] mm/backing-dev.c: fix an error handling path in  'cgwb_create()' Jens Axboe <axboe@kernel.dk> - 2017-09-11 22:00 +0200
    Re: [PATCH] mm/backing-dev.c: fix an error handling path in  'cgwb_create()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-11 22:10 +0200
      Re: [PATCH] mm/backing-dev.c: fix an error handling path in  'cgwb_create()' Jens Axboe <axboe@kernel.dk> - 2017-09-11 22:10 +0200
  Re: [PATCH] mm/backing-dev.c: fix an error handling path in  'cgwb_create()' Jan Kara <jack@suse.cz> - 2017-09-11 22:20 +0200
    Re: [PATCH] mm/backing-dev.c: fix an error handling path in  'cgwb_create()' Jens Axboe <axboe@kernel.dk> - 2017-09-11 22:20 +0200

csiph-web