Commit 5b3d5aea authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

fat: ix mount option parsing

parse_options() is supposed to return value < 0 on error however we
returned 0 (success) in a lot of cases.  This actually was not a problem
in practice because match_token() used by parse_options() is clever and
catches most of the problems for us.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58156c8f
...@@ -972,41 +972,41 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, ...@@ -972,41 +972,41 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
break; break;
case Opt_uid: case Opt_uid:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return -EINVAL;
opts->fs_uid = make_kuid(current_user_ns(), option); opts->fs_uid = make_kuid(current_user_ns(), option);
if (!uid_valid(opts->fs_uid)) if (!uid_valid(opts->fs_uid))
return 0; return -EINVAL;
break; break;
case Opt_gid: case Opt_gid:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return -EINVAL;
opts->fs_gid = make_kgid(current_user_ns(), option); opts->fs_gid = make_kgid(current_user_ns(), option);
if (!gid_valid(opts->fs_gid)) if (!gid_valid(opts->fs_gid))
return 0; return -EINVAL;
break; break;
case Opt_umask: case Opt_umask:
if (match_octal(&args[0], &option)) if (match_octal(&args[0], &option))
return 0; return -EINVAL;
opts->fs_fmask = opts->fs_dmask = option; opts->fs_fmask = opts->fs_dmask = option;
break; break;
case Opt_dmask: case Opt_dmask:
if (match_octal(&args[0], &option)) if (match_octal(&args[0], &option))
return 0; return -EINVAL;
opts->fs_dmask = option; opts->fs_dmask = option;
break; break;
case Opt_fmask: case Opt_fmask:
if (match_octal(&args[0], &option)) if (match_octal(&args[0], &option))
return 0; return -EINVAL;
opts->fs_fmask = option; opts->fs_fmask = option;
break; break;
case Opt_allow_utime: case Opt_allow_utime:
if (match_octal(&args[0], &option)) if (match_octal(&args[0], &option))
return 0; return -EINVAL;
opts->allow_utime = option & (S_IWGRP | S_IWOTH); opts->allow_utime = option & (S_IWGRP | S_IWOTH);
break; break;
case Opt_codepage: case Opt_codepage:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return -EINVAL;
opts->codepage = option; opts->codepage = option;
break; break;
case Opt_flush: case Opt_flush:
...@@ -1014,9 +1014,9 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, ...@@ -1014,9 +1014,9 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
break; break;
case Opt_time_offset: case Opt_time_offset:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return -EINVAL;
if (option < -12 * 60 || option > 12 * 60) if (option < -12 * 60 || option > 12 * 60)
return 0; return -EINVAL;
opts->tz_set = 1; opts->tz_set = 1;
opts->time_offset = option; opts->time_offset = option;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment