Skip to contentSkip to conversation

ntfs3: Fix showing umask option

PATCH New Alessandro Astone 1 participant 1 message Nov 27, 2021 NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ntfs3: Fix showing umask option

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.

---
 fs/ntfs3/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/super.c +2 -2
index 29813200c7af..815a597a45ab 100644
@@ -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
Signature · 1 line
2.33.1