Skip to content

Commit

Permalink
fat: Fix statfs->f_namelen
Browse files Browse the repository at this point in the history
pathconf(, _PC_NAME_MAX) is too small for long Unicode filename on fat.

255 as max filename size on fat is Unicode UTF-16 characters.
it's not byte size.

https://bugzilla.kernel.org/show_bug.cgi?id=16469

To fix it, this returns "len * NLS_MAX_CHARSET_SIZE" instead.

Reported-by: Takumi Asaki <[email protected]>
Signed-off-by: OGAWA Hirofumi <[email protected]>
  • Loading branch information
OGAWAHirofumi committed Apr 12, 2011
1 parent 869f58c commit f68e542
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_bavail = sbi->free_clusters;
buf->f_fsid.val[0] = (u32)id;
buf->f_fsid.val[1] = (u32)(id >> 32);
buf->f_namelen = sbi->options.isvfat ? FAT_LFN_LEN : 12;
buf->f_namelen =
(sbi->options.isvfat ? FAT_LFN_LEN : 12) * NLS_MAX_CHARSET_SIZE;

return 0;
}
Expand Down

0 comments on commit f68e542

Please sign in to comment.