Skip to contentSkip to conversation

nvmet: nvmet_sq_init(): fix use of uninitialized variable

PATCH In review Wilfred Mallawa 4 participants 4 messages May 10, 2025 – May 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: nvmet_sq_init(): fix use of uninitialized variable

From: Wilfred Mallawa <[email protected]>

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

Fixes 206372d7c565 ("nvmet: support completion queue sharing")
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
index 042039011d7c..e30545586302 100644
@@ -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) {
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Wilfred Mallawa

From: Wilfred Mallawa <[email protected]>

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

Fixes 206372d7c565 ("nvmet: support completion queue sharing")

Thanks for tagging to report! Looks good.

#3 lore raw

Great! Thanks Christoph!

Wilfred

Quoted 3 lines · Christoph Hellwig

Thanks,

I've folded this into the original commit.