summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-11-08 10:59:03 +0100
committerJens Axboe <axboe@kernel.dk>2017-11-10 19:53:25 -0700
commita47619b5c6ead6c2e10b8114a5e9291a1679a7c3 (patch)
tree4eac937d6b7fb373a118381c286363e5c3a9ed9b /drivers
parent0c6af1ccd5fd9ac640aef01c8de0043837451a04 (diff)
downloadlinux-stable-a47619b5c6ead6c2e10b8114a5e9291a1679a7c3.tar.gz
linux-stable-a47619b5c6ead6c2e10b8114a5e9291a1679a7c3.tar.bz2
linux-stable-a47619b5c6ead6c2e10b8114a5e9291a1679a7c3.zip
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>
Diffstat (limited to 'drivers')
-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;
}