[PATCH] isofs: Fix isofs_show_options()

From: David Howells
Date: Tue Jul 11 2017 - 11:23:13 EST


Hi Al,

The isofs patch needs a small fix to handle a signed/unsigned comparison that
the compiler didn't flag - thanks to Dan for catching it.

It should be noted, however, as mentioned in a previous email, the session
number handing appears to be incorrect between where it is parsed and where it
is used.

David
---
isofs: Fix isofs_show_options()

isofs_show_options() compares sbi->s_session to -1, but s_session is an
unsigned char, so the comparison isn't right. Compare against 255 instead.

Further, 1 needs subtracting from the session number to counteract the
increment in the option parser.

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index f80ee600d1bc..add72c995f90 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -492,7 +492,7 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)

if (sbi->s_check) seq_printf(m, ",check=%c", sbi->s_check);
if (sbi->s_mapping) seq_printf(m, ",map=%c", sbi->s_mapping);
- if (sbi->s_session != -1) seq_printf(m, ",session=%u", sbi->s_session);
+ if (sbi->s_session != 255) seq_printf(m, ",session=%u", sbi->s_session - 1);
if (sbi->s_sbsector != -1) seq_printf(m, ",sbsector=%u", sbi->s_sbsector);

if (root->d_sb->s_blocksize != 1024)