summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-11-08 12:59:03 +0300
committerJens Axboe <axboe@kernel.dk>2017-11-11 05:53:25 +0300
commita47619b5c6ead6c2e10b8114a5e9291a1679a7c3 (patch)
tree4eac937d6b7fb373a118381c286363e5c3a9ed9b
parent0c6af1ccd5fd9ac640aef01c8de0043837451a04 (diff)
downloadlinux-a47619b5c6ead6c2e10b8114a5e9291a1679a7c3.tar.xz
nvme: compare NQN string with right size
Copy subnqns using NVMF_NQN_SIZE as it is < 256 Signed-off-by: Javier González <javier@cnexlabs.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 65fd2fc1ae3c..8a60cc786220 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1810,7 +1810,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;
}