mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nbd: Fix error handling
@ 2016-10-30  4:28 Christophe JAILLET
  2016-10-30 15:02 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2016-10-30  4:28 UTC (permalink / raw)
  To: mpa, jbacik, axboe
  Cc: nbd-general, linux-kernel, kernel-janitors, Christophe JAILLET

'blk_mq_alloc_request()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

Fixes: 	fd8383fd88a2 ("nbd: convert to blkmq")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 19a16b2dbb91..7a1048755914 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 			return -EINVAL;
 
 		sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
-		if (!sreq)
+		if (IS_ERR(sreq))
 			return -ENOMEM;
 
 		mutex_unlock(&nbd->tx_lock);
-- 
2.9.3

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

* Re: [PATCH] nbd: Fix error handling
  2016-10-30  4:28 [PATCH] nbd: Fix error handling Christophe JAILLET
@ 2016-10-30 15:02 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2016-10-30 15:02 UTC (permalink / raw)
  To: Christophe JAILLET, mpa, jbacik
  Cc: nbd-general, linux-kernel, kernel-janitors

On 10/29/2016 10:28 PM, Christophe JAILLET wrote:
> 'blk_mq_alloc_request()' returns an error pointer in case of error, not
> NULL. So test it with IS_ERR.
>
> Fixes: 	fd8383fd88a2 ("nbd: convert to blkmq")

Applied, thanks.

-- 
Jens Axboe

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

end of thread, other threads:[~2016-10-30 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-30  4:28 [PATCH] nbd: Fix error handling Christophe JAILLET
2016-10-30 15:02 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®