linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: replace strncpy with memcpy in xattr listing
@ 2025-06-17 13:14 ` Pranav Tyagi
  2025-06-30 12:19   ` Carlos Maiolino
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Pranav Tyagi @ 2025-06-17 13:14 UTC (permalink / raw)
  To: cem; +Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees,
	Pranav Tyagi

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';
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  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
  2025-06-30 14:59   ` Darrick J. Wong
  2025-07-08 12:00   ` Carlos Maiolino
  2 siblings, 1 reply; 9+ messages in thread
From: Carlos Maiolino @ 2025-06-30 12:19 UTC (permalink / raw)
  To: Pranav Tyagi; +Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees

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?


> 
> --
> 2.49.0
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  2025-06-30 12:19   ` Carlos Maiolino
@ 2025-06-30 12:48     ` Pranav Tyagi
  2025-06-30 18:34       ` Carlos Maiolino
  0 siblings, 1 reply; 9+ messages in thread
From: Pranav Tyagi @ 2025-06-30 12:48 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees

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
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  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 14:59   ` Darrick J. Wong
  2025-07-08 12:00   ` Carlos Maiolino
  2 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-06-30 14:59 UTC (permalink / raw)
  To: Pranav Tyagi; +Cc: cem, skhan, linux-xfs, linux-kernel, linux-kernel-mentees

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>

'tis better than the three previous attempts at this (compliments on
working out that *name isn't a null terminated string!), so

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  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';
>  
> -- 
> 2.49.0
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  2025-06-30 12:48     ` Pranav Tyagi
@ 2025-06-30 18:34       ` Carlos Maiolino
  2025-07-07 14:32         ` Pranav Tyagi
  0 siblings, 1 reply; 9+ messages in thread
From: Carlos Maiolino @ 2025-06-30 18:34 UTC (permalink / raw)
  To: Pranav Tyagi; +Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees

On Mon, Jun 30, 2025 at 06:18:06PM +0530, Pranav Tyagi wrote:
> 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.

Fair enough. This is the kind of information that's worth
to add to the patch description on your future patches.

No need to re-send this again.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  2025-06-30 18:34       ` Carlos Maiolino
@ 2025-07-07 14:32         ` Pranav Tyagi
  2025-07-08  9:59           ` Carlos Maiolino
  0 siblings, 1 reply; 9+ messages in thread
From: Pranav Tyagi @ 2025-07-07 14:32 UTC (permalink / raw)
  To: Carlos Maiolino, Darrick J. Wong
  Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees

On Tue, Jul 1, 2025 at 12:04 AM Carlos Maiolino <cem@kernel.org> wrote:
>
> On Mon, Jun 30, 2025 at 06:18:06PM +0530, Pranav Tyagi wrote:
> > 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.
>
> Fair enough. This is the kind of information that's worth
> to add to the patch description on your future patches.
>
> No need to re-send this again.
>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

Thanks Darrick and Carlos for the Reviewed-by tag.

I also wanted to ask if this patch has been queued for merging.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  2025-07-07 14:32         ` Pranav Tyagi
@ 2025-07-08  9:59           ` Carlos Maiolino
  2025-07-08 10:19             ` Pranav Tyagi
  0 siblings, 1 reply; 9+ messages in thread
From: Carlos Maiolino @ 2025-07-08  9:59 UTC (permalink / raw)
  To: Pranav Tyagi
  Cc: Darrick J. Wong, skhan, linux-xfs, linux-kernel,
	linux-kernel-mentees

On Mon, Jul 07, 2025 at 08:02:06PM +0530, Pranav Tyagi wrote:
> On Tue, Jul 1, 2025 at 12:04 AM Carlos Maiolino <cem@kernel.org> wrote:
> >
> > On Mon, Jun 30, 2025 at 06:18:06PM +0530, Pranav Tyagi wrote:
> > > 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.
> >
> > Fair enough. This is the kind of information that's worth
> > to add to the patch description on your future patches.
> >
> > No need to re-send this again.
> >
> > Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> 
> Thanks Darrick and Carlos for the Reviewed-by tag.
> 
> I also wanted to ask if this patch has been queued for merging.

xfs teams sends an ANNOUNCE email every merge done to the for-next
branch, you can check if your patches are mentioned there, if not
they are not queued up yet.

Also, you'll likely receive a message saying your patch has been pushed
into for-next.

Note though that just because your patch has been added to for-next,
doesn't automatically mean it will be merged. Several tests still
happens on patches pushed to for-next branch (which are merged into
linux-next) and linux-next 'after' your patch has been merged into.

So your patch(es) being merged are conditional to that.

Carlos

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  2025-07-08  9:59           ` Carlos Maiolino
@ 2025-07-08 10:19             ` Pranav Tyagi
  0 siblings, 0 replies; 9+ messages in thread
From: Pranav Tyagi @ 2025-07-08 10:19 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Darrick J. Wong, skhan, linux-xfs, linux-kernel,
	linux-kernel-mentees

On Tue, Jul 8, 2025 at 3:29 PM Carlos Maiolino <cem@kernel.org> wrote:
>
> On Mon, Jul 07, 2025 at 08:02:06PM +0530, Pranav Tyagi wrote:
> > On Tue, Jul 1, 2025 at 12:04 AM Carlos Maiolino <cem@kernel.org> wrote:
> > >
> > > On Mon, Jun 30, 2025 at 06:18:06PM +0530, Pranav Tyagi wrote:
> > > > 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.
> > >
> > > Fair enough. This is the kind of information that's worth
> > > to add to the patch description on your future patches.
> > >
> > > No need to re-send this again.
> > >
> > > Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> >
> > Thanks Darrick and Carlos for the Reviewed-by tag.
> >
> > I also wanted to ask if this patch has been queued for merging.
>
> xfs teams sends an ANNOUNCE email every merge done to the for-next
> branch, you can check if your patches are mentioned there, if not
> they are not queued up yet.
>
> Also, you'll likely receive a message saying your patch has been pushed
> into for-next.
>
> Note though that just because your patch has been added to for-next,
> doesn't automatically mean it will be merged. Several tests still
> happens on patches pushed to for-next branch (which are merged into
> linux-next) and linux-next 'after' your patch has been merged into.
>
> So your patch(es) being merged are conditional to that.
>
> Carlos
>

Hi,

Thanks for the clarification. I'll keep an eye on the announce emails
and wait to see if my patch gets mentioned or pushed to the for-next
branch.

Appreciate the insight into the review and testing process. That
helps a lot.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing
  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 14:59   ` Darrick J. Wong
@ 2025-07-08 12:00   ` Carlos Maiolino
  2 siblings, 0 replies; 9+ messages in thread
From: Carlos Maiolino @ 2025-07-08 12:00 UTC (permalink / raw)
  To: Pranav Tyagi; +Cc: skhan, linux-xfs, linux-kernel, linux-kernel-mentees

On Tue, 17 Jun 2025 18:44:46 +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.
> 
> 

Applied to for-next, thanks!

[1/1] xfs: replace strncpy with memcpy in xattr listing
      commit: f2eb2796b95118b877b63d9fcd3459e70494a498

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-07-08 12:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

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).