linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pranav Tyagi <pranav.tyagi03@gmail.com>
To: Carlos Maiolino <cem@kernel.org>
Cc: skhan@linuxfoundation.org, linux-xfs@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
Date: Mon, 30 Jun 2025 18:18:06 +0530	[thread overview]
Message-ID: <CAH4c4j+dhh9uW=GOoxaaefBTWQtbLeWQs1SqrWwpka9R8mwBTg@mail.gmail.com> (raw)
In-Reply-To: <huml6d5naz4kf6a3kh5g74dyrtivlaqyzajzwwmyvnpsqhuj3d@7zazaxb3225t>

On Mon, Jun 30, 2025 at 5:49 PM Carlos Maiolino <cem@kernel.org> wrote:
>
> On Tue, Jun 17, 2025 at 06:44:46PM +0530, Pranav Tyagi wrote:
> > Use memcpy() in place of strncpy() in __xfs_xattr_put_listent().
> > The length is known and a null byte is added manually.
> >
> > No functional change intended.
> >
> > Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
> > ---
> >  fs/xfs/xfs_xattr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
> > index 0f641a9091ec..ac5cecec9aa1 100644
> > --- a/fs/xfs/xfs_xattr.c
> > +++ b/fs/xfs/xfs_xattr.c
> > @@ -243,7 +243,7 @@ __xfs_xattr_put_listent(
> >       offset = context->buffer + context->count;
> >       memcpy(offset, prefix, prefix_len);
> >       offset += prefix_len;
> > -     strncpy(offset, (char *)name, namelen);                 /* real name */
> > +     memcpy(offset, (char *)name, namelen);                  /* real name */
> >       offset += namelen;
> >       *offset = '\0';
>
> What difference does it make?

I intended this to be a cleanup patch as strncpy()
is deprecated and its use discouraged.

Regards
Pranav Tyagi
>
>
> >
> > --
> > 2.49.0
> >

  reply	other threads:[~2025-06-30 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <oxpeGQP7AC5GXfnifSYyeW7X_URDJhOvCxTG09iGmuvIXd330ZdXanoBmbUB3wpOcIORP1CakEzevsjtJKynhw==@protonmail.internalid>
2025-06-17 13:14 ` [PATCH] xfs: replace strncpy with memcpy in xattr listing Pranav Tyagi
2025-06-30 12:19   ` Carlos Maiolino
2025-06-30 12:48     ` Pranav Tyagi [this message]
2025-06-30 18:34       ` Carlos Maiolino
2025-07-07 14:32         ` Pranav Tyagi
2025-07-08  9:59           ` Carlos Maiolino
2025-07-08 10:19             ` Pranav Tyagi
2025-06-30 14:59   ` Darrick J. Wong
2025-07-08 12:00   ` Carlos Maiolino

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='CAH4c4j+dhh9uW=GOoxaaefBTWQtbLeWQs1SqrWwpka9R8mwBTg@mail.gmail.com' \
    --to=pranav.tyagi03@gmail.com \
    --cc=cem@kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=skhan@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).