summaryrefslogtreecommitdiff
path: root/drivers/nvme/target/discovery.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2018-10-09 00:28:51 +0300
committerChristoph Hellwig <hch@lst.de>2018-10-17 09:58:26 +0300
commit5eadc9cce17100caef88e972abeeeca7ef6d8a92 (patch)
treeb1a5db932cce38dae81a9ba074d640b3c2525657 /drivers/nvme/target/discovery.c
parent40581d1a91a1527e1e15350e479156810a389a96 (diff)
downloadlinux-5eadc9cce17100caef88e972abeeeca7ef6d8a92.tar.xz
nvmet: use strlcpy() instead of strcpy()
Although the code modified by this patch looks fine to me, this patch avoids that Coverity reports the following complaint (ID 1364971 and ID 1364973): "You might overrun the 256-character fixed-size string id->subnqn". Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme/target/discovery.c')
-rw-r--r--drivers/nvme/target/discovery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index d1954f4ca28d..bc0aa0bf1543 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -174,7 +174,7 @@ static void nvmet_execute_identify_disc_ctrl(struct nvmet_req *req)
if (req->port->inline_data_size)
id->sgls |= cpu_to_le32(1 << 20);
- strcpy(id->subnqn, ctrl->subsys->subsysnqn);
+ strlcpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn));
status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));