btrfs: replace strcpy() with strscpy()
authorBrahmajit Das <listout@listout.xyz>
Fri, 20 Jun 2025 16:49:57 +0000 (22:19 +0530)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:05:00 +0000 (00:05 +0200)
commit164299ba117619643f6f042d487153d45a142999
tree748a10a2aa1ccd6115e175d3097501abb27e2ad1
parentb37eb352c4c6ecd8e6aa62d08dbf3f5d3ce8afd7
btrfs: replace strcpy() with strscpy()

strcpy() is discouraged from use due to lack of bounds checking.
Replaces it 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().

Link: https://github.com/KSPP/linux/issues/88
Suggested-by: Anthony Iliopoulos <ailiop@suse.com>
Signed-off-by: Brahmajit Das <bdas@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c
fs/btrfs/relocation.c
fs/btrfs/send.c
fs/btrfs/volumes.c
fs/btrfs/xattr.c