[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1510135144-1557-1-git-send-email-javier@cnexlabs.com>
Date: Wed, 8 Nov 2017 10:59:03 +0100
From: "Javier González" <jg@...htnvm.io>
To: hch@....de, sagi@...mberg.me, keith.busch@...el.com,
joe@...ches.com
Cc: linux-nvme@...ts.infradead.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
Javier González <jg@...htnvm.io>,
Javier González <javier@...xlabs.com>
Subject: [PATCH v2] nvme: compare NQN string with right size
From: Javier González <jg@...htnvm.io>
Copy subnqns using NVMF_NQN_SIZE as it is < 256
Changes since V1:
- Fix commit message to indicate that it is a copy and not a comparison.
Signed-off-by: Javier González <javier@...xlabs.com>
Reviewed-by: Christoph Hellwig <hch@....de>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 37f9039bb9ca..b3bc9fb39a6c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1744,7 +1744,7 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
- strcpy(ctrl->subnqn, id->subnqn);
+ strncpy(ctrl->subnqn, id->subnqn, NVMF_NQN_SIZE);
return;
}
--
2.7.4
Powered by blists - more mailing lists