From: Javier González Date: Wed, 8 Nov 2017 09:59:03 +0000 (+0100) Subject: nvme: compare NQN string with right size X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=a47619b5c6ead6c2e10b8114a5e9291a1679a7c3;p=openwrt%2Fstaging%2Fblogic.git nvme: compare NQN string with right size Copy subnqns using NVMF_NQN_SIZE as it is < 256 Signed-off-by: Javier González Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- 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; }