public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvme: compare NQN string with right size
@ 2017-11-08  9:59 Javier González
  2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Javier González @ 2017-11-08  9:59 UTC (permalink / raw)
  To: hch, sagi, keith.busch, joe
  Cc: linux-nvme, linux-block, linux-kernel, Javier González,
	Javier González

From: Javier González <jg@lightnvm.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@cnexlabs.com>
Reviewed-by: Christoph Hellwig <hch@lst.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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-08 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-08  9:59 [PATCH v2] nvme: compare NQN string with right size Javier González
2017-11-08  9:59 ` [PATCH v2] nvme: fix eui_show() print format Javier González
2017-11-08 10:08   ` Sagi Grimberg
2017-11-08 10:08 ` [PATCH v2] nvme: compare NQN string with right size Sagi Grimberg
2017-11-08 18:20 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox