From: Eric Biggers <[email protected]>
utf16s_to_utf8s() and utf8s_to_utf16s() take the number of characters,
not the number of bytes.
Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
Signed-off-by: Eric Biggers <[email protected]>
---
fs/f2fs/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index eb1aa9b75eda..d521a582d94d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3094,7 +3094,7 @@ static int f2fs_get_volume_name(struct file *filp,
unsigned long arg)
down_read(&sbi->sb_lock);
count = utf16s_to_utf8s(sbi->raw_super->volume_name,
- sizeof(sbi->raw_super->volume_name),
+ ARRAY_SIZE(sbi->raw_super->volume_name),
UTF16_LITTLE_ENDIAN, vbuf, MAX_VOLUME_NAME);
up_read(&sbi->sb_lock);
@@ -3139,7 +3139,7 @@ static int f2fs_set_volume_name(struct file *filp,
unsigned long arg)
sizeof(sbi->raw_super->volume_name));
utf8s_to_utf16s(vbuf, MAX_VOLUME_NAME, UTF16_LITTLE_ENDIAN,
sbi->raw_super->volume_name,
- sizeof(sbi->raw_super->volume_name));
+ ARRAY_SIZE(sbi->raw_super->volume_name));
err = f2fs_commit_super(sbi, false);
--
2.22.0
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel