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>
This commit is contained in:
Javier González 2017-11-08 10:59:03 +01:00 committed by Jens Axboe
parent 0c6af1ccd5
commit a47619b5c6

View File

@ -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;
}