public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Yang <danielyangkang@gmail.com>
To: Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	linux-nfs@vger.kernel.org (open list:NFS, SUNRPC,
	AND LOCKD CLIENTS), linux-kernel@vger.kernel.org (open list)
Cc: Daniel Yang <danielyangkang@gmail.com>
Subject: [PATCH] nfs_sysfs_link_rpc_client(): Replace strcpy with strscpy
Date: Tue,  5 Nov 2024 18:49:51 -0800	[thread overview]
Message-ID: <20241106024952.494718-1-danielyangkang@gmail.com> (raw)

The function strcpy is deprecated due to lack of bounds checking. The
recommended replacement is strscpy.

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
---
 fs/nfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index bf378ecd5..f3d0b2ef9 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -280,7 +280,7 @@ void nfs_sysfs_link_rpc_client(struct nfs_server *server,
 	char name[RPC_CLIENT_NAME_SIZE];
 	int ret;
 
-	strcpy(name, clnt->cl_program->name);
+	strscpy(name, clnt->cl_program->name);
 	strcat(name, uniq ? uniq : "");
 	strcat(name, "_client");
 
-- 
2.39.5


             reply	other threads:[~2024-11-06  2:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06  2:49 Daniel Yang [this message]
2024-11-06 19:30 ` [PATCH] nfs_sysfs_link_rpc_client(): Replace strcpy with strscpy Benjamin Coddington
2024-11-06 20:20 ` Roland Mainz
2024-11-06 20:40   ` Benjamin Coddington
2024-11-09 11:11     ` Kernel strscpy() should be renamed to kstrscpy() " Sebastian Feld
2024-11-09 11:28       ` Benjamin Coddington
2024-11-09 12:01       ` Theodore Ts'o

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=20241106024952.494718-1-danielyangkang@gmail.com \
    --to=danielyangkang@gmail.com \
    --cc=anna@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@kernel.org \
    /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