[PATCH] nvmet: nvmet_sq_init(): fix use of uninitialized variable

Wilfred Mallawa posted 1 patch 7 months, 1 week ago
drivers/nvme/target/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] nvmet: nvmet_sq_init(): fix use of uninitialized variable
Posted by Wilfred Mallawa 7 months, 1 week ago
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>

This fixes a bug where an uninitialized return value is used in
nvmet_sq_init().

Fixes: 206372d7c565 ("nvmet: support completion queue sharing")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505091619.QFU1fxsd-lkp@intel.com/
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 042039011d7c..e30545586302 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1012,7 +1012,7 @@ int nvmet_sq_init(struct nvmet_sq *sq, struct nvmet_cq *cq)
 	int ret;
 
 	if (!nvmet_cq_get(cq))
-		return ret;
+		return -EINVAL;
 
 	ret = percpu_ref_init(&sq->ref, nvmet_sq_free, 0, GFP_KERNEL);
 	if (ret) {
-- 
2.49.0
Re: [PATCH] nvmet: nvmet_sq_init(): fix use of uninitialized variable
Posted by Christoph Hellwig 7 months, 1 week ago
Thanks,

I've folded this into the original commit.
Re: [PATCH] nvmet: nvmet_sq_init(): fix use of uninitialized variable
Posted by Wilfred Mallawa 7 months, 1 week ago
Great! Thanks Christoph!

Wilfred
On Mon, 2025-05-12 at 07:24 +0200, Christoph Hellwig wrote:
> Thanks,
> 
> I've folded this into the original commit.
Re: [PATCH] nvmet: nvmet_sq_init(): fix use of uninitialized variable
Posted by Keith Busch 7 months, 1 week ago
On Sat, May 10, 2025 at 09:59:05AM +1000, Wilfred Mallawa wrote:
> From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> 
> This fixes a bug where an uninitialized return value is used in
> nvmet_sq_init().
> 
> Fixes: 206372d7c565 ("nvmet: support completion queue sharing")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505091619.QFU1fxsd-lkp@intel.com/
> Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>

Thanks for tagging to report! Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>