[PATCH] nvme: uninitialized return in nvme_ns_head_chr_uring_cmd()

Dan Carpenter dan.carpenter at oracle.com
Mon May 9 02:06:42 PDT 2022


The "ret" value is not set if "ns" is zero.

Fixes: 86116c2f6fee ("nvme: wire-up uring-cmd support for io-passthru on char-device.")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
 drivers/nvme/host/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 4b91e452768b..c118559d47f0 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -688,7 +688,7 @@ int nvme_ns_head_chr_uring_cmd(struct io_uring_cmd *ioucmd,
 	struct nvme_ns_head *head = container_of(cdev, struct nvme_ns_head, cdev);
 	int srcu_idx = srcu_read_lock(&head->srcu);
 	struct nvme_ns *ns = nvme_find_path(head);
-	int ret;
+	int ret = 0;
 
 	if (ns)
 		ret = nvme_ns_uring_cmd(ns, ioucmd, issue_flags);
-- 
2.35.1




More information about the Linux-nvme mailing list