Re: [PATCH v3] btrfs: replace deprecated strcpy with strscpy
From: David Sterba
Date: Fri Jun 20 2025 - 08:27:30 EST
On Fri, Jun 20, 2025 at 07:13:44AM +0530, Brahmajit Das wrote:
> strcpy is deprecated due to lack of bounds checking. This patch replaces
> strcpy with strscpy, the recommended alternative for null terminated
> strings, to follow best practices.
>
> There are instances where strscpy cannot be used such as where both the
> source and destination are character pointers. In that instance we can
> use sysfs_emit or a memcpy.
>
> Update in v2: using sysfs_emit instead of scnprintf
> Update in v3: Removed string.h in xattr, since we are not using any
> fucntions from string.h and fixed length in memcpy in volumes.c
This should be placed under the "---" marker. If it's a new information
relevant for the patch then it should be a normal part of the changelog.
> No functional changes intended.
No need to write this.
>
> Link: https://github.com/KSPP/linux/issues/88
No newline here.
> Suggested-by: Anthony Iliopoulos <ailiop@xxxxxxxx>
> Suggested-by: Mark Harmstone <mark@xxxxxxxxxxxxx>
> Signed-off-by: Brahmajit Das <listout@xxxxxxxxxxx>
Otherwise it looks good, thanks.