From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Abdul Rahim <abdul.rahim@myyahoo.com>,
xiubli@redhat.com, idryomov@gmail.com
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Use strscpy() instead of strcpy()
Date: Tue, 12 Nov 2024 07:21:54 +0100 [thread overview]
Message-ID: <8fef8eab-cd82-4e05-ad9b-1bb8b5fe974b@wanadoo.fr> (raw)
In-Reply-To: <20241111221037.92853-1-abdul.rahim@myyahoo.com>
Le 11/11/2024 à 23:10, Abdul Rahim a écrit :
> strcpy() is generally considered unsafe and use of strscpy() is
> recommended [1]
>
> this fixes checkpatch warning:
> WARNING: Prefer strscpy over strcpy
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> ---
> fs/ceph/export.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/export.c b/fs/ceph/export.c
> index 44451749c544..0e5b3c7b3756 100644
> --- a/fs/ceph/export.c
> +++ b/fs/ceph/export.c
> @@ -452,7 +452,7 @@ static int __get_snap_name(struct dentry *parent, char *name,
> goto out;
> if (ceph_snap(inode) == CEPH_SNAPDIR) {
> if (ceph_snap(dir) == CEPH_NOSNAP) {
> - strcpy(name, fsc->mount_options->snapdir_name);
> + strscpy(name, fsc->mount_options->snapdir_name);
This does not compile because when the size of 'name' is not known at
compilation time, you need to use the 3-argument version of strscpy().
Please always compile test your patches before sending them. Even, when
the change looks trivial.
CJ
> err = 0;
> }
> goto out;
next prev parent reply other threads:[~2024-11-12 6:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241111221037.92853-1-abdul.rahim.ref@myyahoo.com>
2024-11-11 22:10 ` Abdul Rahim
2024-11-12 6:21 ` Christophe JAILLET [this message]
2024-11-13 20:15 ` Abdul Rahim
2024-11-13 21:28 ` Christophe JAILLET
2024-11-14 9:14 ` Abdul Rahim
2024-11-14 20:53 ` Christophe JAILLET
2024-11-15 11:38 ` Abdul Rahim
2024-11-13 1:06 ` kernel test robot
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=8fef8eab-cd82-4e05-ad9b-1bb8b5fe974b@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=abdul.rahim@myyahoo.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xiubli@redhat.com \
/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
all inboxes | Powered by JetHome®