Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org,
	ming.lei@redhat.com
Subject: Re: [PATCH 1/3] ublk_drv: fix an IS_ERR() vs NULL check
Date: Mon, 18 Jul 2022 20:19:58 +0800	[thread overview]
Message-ID: <YtVP7qLG6Cgx+xCN@T590> (raw)
In-Reply-To: <YtVAgedTsQVK1oTM@kili>

On Mon, Jul 18, 2022 at 02:14:09PM +0300, Dan Carpenter wrote:
> The blk_mq_alloc_disk_for_queue() doesn't return error pointers, it
> returns NULL on error.
> 
> Fixes: cebbe577cb17 ("ublk_drv: fix request queue leak")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/block/ublk_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index 52fd0af8a4f2..97725d13e4bd 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -1175,8 +1175,8 @@ static int ublk_add_dev(struct ublk_device *ub)
>  
>  	disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue,
>  						 &ublk_bio_compl_lkclass);
> -	if (IS_ERR(disk)) {
> -		err = PTR_ERR(disk);
> +	if (!disk) {
> +		err = -ENOMEM;
>  		goto out_free_request_queue;
>  	}

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming


  reply	other threads:[~2022-07-18 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 11:14 [PATCH 1/3] ublk_drv: fix an IS_ERR() vs NULL check Dan Carpenter
2022-07-18 12:19 ` Ming Lei [this message]
2022-07-18 19:13 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtVP7qLG6Cgx+xCN@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox