From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] NVMe: return an error code if blk_mq_alloc_tag_set() fails
Date: Mon, 19 Jan 2015 14:43:27 +0000 [thread overview]
Message-ID: <20150119144327.GE19086@mwanda> (raw)
In the current code, if blk_mq_alloc_tag_set() fails then it returns
zero (success) instead of preserving the error code. The caller is not
expecting that and the kernel could be left in an inconsistent state.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis stuff. Not tested.
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index cb529e9..2ff5efc 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2152,7 +2152,8 @@ static int nvme_dev_add(struct nvme_dev *dev)
dev->tagset.flags = BLK_MQ_F_SHOULD_MERGE;
dev->tagset.driver_data = dev;
- if (blk_mq_alloc_tag_set(&dev->tagset))
+ res = blk_mq_alloc_tag_set(&dev->tagset);
+ if (res)
goto out;
id_ns = mem;
WARNING: multiple messages have this Message-ID (diff)
From: dan.carpenter@oracle.com (Dan Carpenter)
Subject: [patch] NVMe: return an error code if blk_mq_alloc_tag_set() fails
Date: Mon, 19 Jan 2015 17:43:27 +0300 [thread overview]
Message-ID: <20150119144327.GE19086@mwanda> (raw)
In the current code, if blk_mq_alloc_tag_set() fails then it returns
zero (success) instead of preserving the error code. The caller is not
expecting that and the kernel could be left in an inconsistent state.
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
Static analysis stuff. Not tested.
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index cb529e9..2ff5efc 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2152,7 +2152,8 @@ static int nvme_dev_add(struct nvme_dev *dev)
dev->tagset.flags = BLK_MQ_F_SHOULD_MERGE;
dev->tagset.driver_data = dev;
- if (blk_mq_alloc_tag_set(&dev->tagset))
+ res = blk_mq_alloc_tag_set(&dev->tagset);
+ if (res)
goto out;
id_ns = mem;
next reply other threads:[~2015-01-19 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 14:43 Dan Carpenter [this message]
2015-01-19 14:43 ` [patch] NVMe: return an error code if blk_mq_alloc_tag_set() fails Dan Carpenter
2015-01-22 4:40 ` Jens Axboe
2015-01-22 16:48 ` Keith Busch
2015-01-22 22:46 ` Jens Axboe
2015-01-22 23:11 ` Keith Busch
2015-01-22 23:15 ` 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=20150119144327.GE19086@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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 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.