All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ublk_drv: fix an IS_ERR() vs NULL check
@ 2022-07-18 11:14 Dan Carpenter
  2022-07-18 12:19 ` Ming Lei
  2022-07-18 19:13 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-07-18 11:14 UTC (permalink / raw)
  To: Jens Axboe, Ming Lei; +Cc: linux-block, kernel-janitors

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;
 	}
 
-- 
2.35.1


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

* Re: [PATCH 1/3] ublk_drv: fix an IS_ERR() vs NULL check
  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
  2022-07-18 19:13 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2022-07-18 12:19 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jens Axboe, linux-block, kernel-janitors, ming.lei

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


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

* Re: [PATCH 1/3] ublk_drv: fix an IS_ERR() vs NULL check
  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
@ 2022-07-18 19:13 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-07-18 19:13 UTC (permalink / raw)
  To: dan.carpenter, ming.lei; +Cc: linux-block, kernel-janitors

On Mon, 18 Jul 2022 14:14:09 +0300, Dan Carpenter wrote:
> The blk_mq_alloc_disk_for_queue() doesn't return error pointers, it
> returns NULL on error.
> 
> 

Applied, thanks!

[1/3] ublk_drv: fix an IS_ERR() vs NULL check
      commit: fe3333f6953848f1c24e91a1cf70eed026dc3a86

Best regards,
-- 
Jens Axboe



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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-07-18 19:13 ` Jens Axboe

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.