Following a suggestion from Dave and everyone who contributed to v1, this 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. Furthermore, this change was tested by xfstests and as it was not an easy task I decided to document on my blog the step by step of how I did it https://meritissimo1.com/blog/2-xfs-tests :). This change does not alter the functionality or introduce any behavioral changes. Changes include: - Replace strncpy with memcpy. --- Changelog: Changes since v1: - Replace strncpy with memcpy instead of strscpy. - The change was tested using xfstests. Link to v1: https://lore.kernel.org/linux-kernel-mentees/CAPZ3m_jXwp1FfsvtR2s3nwATT3fER=Mc6qj+GzKuUhY5tjQFNQ@xxxxxxxxxxxxxx/T/#t Suggested-by: Dave Chinner <david@xxxxxxxxxxxxx> Signed-off-by: Marcelo Moreira <marcelomoreira1905@xxxxxxxxx> --- fs/xfs/scrub/symlink_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/scrub/symlink_repair.c b/fs/xfs/scrub/symlink_repair.c index 953ce7be78dc..5902398185a8 100644 --- a/fs/xfs/scrub/symlink_repair.c +++ b/fs/xfs/scrub/symlink_repair.c @@ -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; } -- 2.50.1