From: Marcelo Moreira <marcelomoreira1905@gmail.com>
To: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
kch@nvidia.com, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org,
~lkcamp/patches@lists.sr.ht
Subject: [PATCH] nvmet: replace strncpy with strscpy
Date: Mon, 31 Mar 2025 21:47:28 -0300 [thread overview]
Message-ID: <20250401004748.29172-1-marcelomoreira1905@gmail.com> (raw)
strncpy() is deprecated due to its lack of NULL-termination
guarantees and unnecessary zero-padding of the destination buffer.
Use strscpy() instead.
Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Marcelo Moreira <marcelomoreira1905@gmail.com>
---
drivers/nvme/target/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index df7207640506..c06f3e04296c 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -119,7 +119,7 @@ static void nvmet_format_discovery_entry(struct nvmf_disc_rsp_page_hdr *hdr,
memcpy(e->trsvcid, port->disc_addr.trsvcid, NVMF_TRSVCID_SIZE);
memcpy(e->traddr, traddr, NVMF_TRADDR_SIZE);
memcpy(e->tsas.common, port->disc_addr.tsas.common, NVMF_TSAS_SIZE);
- strncpy(e->subnqn, subsys_nqn, NVMF_NQN_SIZE);
+ strscpy(e->subnqn, subsys_nqn, NVMF_NQN_SIZE);
}
/*
--
2.49.0
next reply other threads:[~2025-04-01 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 0:47 Marcelo Moreira [this message]
2025-04-03 4:27 ` [PATCH] nvmet: replace strncpy with strscpy Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250401004748.29172-1-marcelomoreira1905@gmail.com \
--to=marcelomoreira1905@gmail.com \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=skhan@linuxfoundation.org \
--cc=~lkcamp/patches@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox