]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: Replace strncpy with memcpy
authorMarcelo Moreira <marcelomoreira1905@gmail.com>
Mon, 24 Nov 2025 17:45:02 +0000 (12:45 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:46:07 +0000 (11:46 +0100)
[ Upstream commit 33ddc796ecbd50cd6211aa9e9eddbf4567038b49 ]

The changes modernizes the code by aligning it with current kernel best
practices. It improves code clarity and consistency, as strncpy is deprecated
as explained in Documentation/process/deprecated.rst. This change does
not alter the functionality or introduce any behavioral changes.

Suggested-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Marcelo Moreira <marcelomoreira1905@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Stable-dep-of: 678e1cc2f482 ("xfs: fix out of bounds memory read error in symlink repair")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/scrub/symlink_repair.c

index 953ce7be78dc2f9fc1436d581fbd04d748c32f74..5902398185a8982a5cfc2938d81084c399b6cc3c 100644 (file)
@@ -185,7 +185,7 @@ xrep_symlink_salvage_inline(
                return 0;
 
        nr = min(XFS_SYMLINK_MAXLEN, xfs_inode_data_fork_size(ip));
-       strncpy(target_buf, ifp->if_data, nr);
+       memcpy(target_buf, ifp->if_data, nr);
        return nr;
 }