[PATCH v4] btrfs: replace deprecated strcpy with strscpy

2025-06-20 Thread Brahmajit Das
. In that instance we can use sysfs_emit. Link: https://github.com/KSPP/linux/issues/88 Suggested-by: Anthony Iliopoulos Suggested-by: David Sterba Signed-off-by: Brahmajit Das --- Changes in v2: using sysfs_emit instead of scnprintf. Changes in v3: Removed string.h in xattr, since we are not

[PATCH v3] btrfs: replace deprecated strcpy with strscpy

2025-06-19 Thread Brahmajit Das
/linux/issues/88 Suggested-by: Anthony Iliopoulos Suggested-by: Mark Harmstone Signed-off-by: Brahmajit Das --- fs/btrfs/ioctl.c | 2 +- fs/btrfs/send.c| 2 +- fs/btrfs/volumes.c | 2 +- fs/btrfs/xattr.c | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs

Re: [PATCH] btrfs: replace deprecated strcpy with strscpy

2025-06-19 Thread Brahmajit Das
On 19.06.2025 18:03, Mark Harmstone wrote: > On 19/06/2025 3.06 pm, 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.

Re: [PATCH v2] btrfs: replace deprecated strcpy with strscpy

2025-06-19 Thread Brahmajit Das
On 19.06.2025 18:06, Mark Harmstone wrote: > On 19/06/2025 4.39 pm, Brahmajit Das wrote: ... > > Surely this doesn't compile... strscpy takes three parameters. > It does, the third parameter is optional. From include/linux/string.h #define strscpy(dst, src, ...) \ CONC

[PATCH v2] btrfs: replace deprecated strcpy with strscpy

2025-06-19 Thread Brahmajit Das
. In that instance we can use sysfs_emit or a memcpy. Update in v2: using sysfs_emit instead of scnprintf No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Suggested-by: Anthony Iliopoulos Signed-off-by: Brahmajit Das --- fs/btrfs/ioctl.c | 2 +- fs/btrfs/send.c

[PATCH] btrfs: replace deprecated strcpy with strscpy

2025-06-19 Thread Brahmajit Das
. In that instance we can use scnprintf or a memcpy. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Brahmajit Das --- fs/btrfs/ioctl.c | 2 +- fs/btrfs/send.c| 2 +- fs/btrfs/volumes.c | 2 +- fs/btrfs/xattr.c | 5 +++-- 4 files changed, 6