diff options
| author | Kees Cook <[email protected]> | 2024-05-23 22:54:12 +0000 |
|---|---|---|
| committer | Theodore Ts'o <[email protected]> | 2024-07-05 17:14:51 +0000 |
| commit | be27cd64461c45a6088a91a04eba5cd44e1767ef (patch) | |
| tree | 4176a9e7543490df24787d87297e2a90d2f6a9ac /fs/ext4/ioctl.c | |
| parent | jbd2: speed up jbd2_transaction_committed() (diff) | |
| download | kernel-be27cd64461c45a6088a91a04eba5cd44e1767ef.tar.gz kernel-be27cd64461c45a6088a91a04eba5cd44e1767ef.zip | |
ext4: use memtostr_pad() for s_volume_name
As with the other strings in struct ext4_super_block, s_volume_name is
not NUL terminated. The other strings were marked in commit 072ebb3bffe6
("ext4: add nonstring annotations to ext4.h"). Using strscpy() isn't
the right replacement for strncpy(); it should use memtostr_pad()
instead.
Reported-by: [email protected]
Closes: https://lore.kernel.org/all/[email protected]/
Fixes: 744a56389f73 ("ext4: replace deprecated strncpy with alternatives")
Signed-off-by: Kees Cook <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
Diffstat (limited to 'fs/ext4/ioctl.c')
| -rw-r--r-- | fs/ext4/ioctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index dab7acd49709..e8bf5972dd47 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1151,7 +1151,7 @@ static int ext4_ioctl_getlabel(struct ext4_sb_info *sbi, char __user *user_label BUILD_BUG_ON(EXT4_LABEL_MAX >= FSLABEL_MAX); lock_buffer(sbi->s_sbh); - strscpy_pad(label, sbi->s_es->s_volume_name); + memtostr_pad(label, sbi->s_es->s_volume_name); unlock_buffer(sbi->s_sbh); if (copy_to_user(user_label, label, sizeof(label))) |
