[PATCH] ntfs3: Fix showing umask option

From: Alessandro Astone
Date: Sat Nov 27 2021 - 08:53:53 EST


fmask and dmask are 16 bit unsigned, but without the explicit cast
printf sign-extends to 32 bit making it print fmask=37777600022
when it should print fmask=0022.

Signed-off-by: Alessandro Astone <ales.astone@xxxxxxxxx>
---
fs/ntfs3/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 29813200c7af..815a597a45ab 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -518,9 +518,9 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",gid=%u",
from_kgid_munged(user_ns, opts->fs_gid));
if (opts->fmask)
- seq_printf(m, ",fmask=%04o", ~opts->fs_fmask_inv);
+ seq_printf(m, ",fmask=%04o", (u16)~opts->fs_fmask_inv);
if (opts->dmask)
- seq_printf(m, ",dmask=%04o", ~opts->fs_dmask_inv);
+ seq_printf(m, ",dmask=%04o", (u16)~opts->fs_dmask_inv);
if (opts->nls)
seq_printf(m, ",iocharset=%s", opts->nls->charset);
else
--
2.33.1