Re: [PATCH] xfs: replace strncpy with memcpy in xattr listing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux