diff options
author | Jan Kara <jack@suse.cz> | 2012-12-17 19:02:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:22 -0500 |
commit | 5b3d5aeaa333850756f41350fed2fc95912b2a4f (patch) | |
tree | b4988767f7b4781596488638b59988d9ef5d5aff /fs/fat | |
parent | 58156c8fbf43e71dd091848d4dbfd780d04016e6 (diff) |
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: Jan Kara <jack@suse.cz>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/inode.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 59ac83be2d5b..3b733a730952 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -972,41 +972,41 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, | |||
972 | break; | 972 | break; |
973 | case Opt_uid: | 973 | case Opt_uid: |
974 | if (match_int(&args[0], &option)) | 974 | if (match_int(&args[0], &option)) |
975 | return 0; | 975 | return -EINVAL; |
976 | opts->fs_uid = make_kuid(current_user_ns(), option); | 976 | opts->fs_uid = make_kuid(current_user_ns(), option); |
977 | if (!uid_valid(opts->fs_uid)) | 977 | if (!uid_valid(opts->fs_uid)) |
978 | return 0; | 978 | return -EINVAL; |
979 | break; | 979 | break; |
980 | case Opt_gid: | 980 | case Opt_gid: |
981 | if (match_int(&args[0], &option)) | 981 | if (match_int(&args[0], &option)) |
982 | return 0; | 982 | return -EINVAL; |
983 | opts->fs_gid = make_kgid(current_user_ns(), option); | 983 | opts->fs_gid = make_kgid(current_user_ns(), option); |
984 | if (!gid_valid(opts->fs_gid)) | 984 | if (!gid_valid(opts->fs_gid)) |
985 | return 0; | 985 | return -EINVAL; |
986 | break; | 986 | break; |
987 | case Opt_umask: | 987 | case Opt_umask: |
988 | if (match_octal(&args[0], &option)) | 988 | if (match_octal(&args[0], &option)) |
989 | return 0; | 989 | return -EINVAL; |
990 | opts->fs_fmask = opts->fs_dmask = option; | 990 | opts->fs_fmask = opts->fs_dmask = option; |
991 | break; | 991 | break; |
992 | case Opt_dmask: | 992 | case Opt_dmask: |
993 | if (match_octal(&args[0], &option)) | 993 | if (match_octal(&args[0], &option)) |
994 | return 0; | 994 | return -EINVAL; |
995 | opts->fs_dmask = option; | 995 | opts->fs_dmask = option; |
996 | break; | 996 | break; |
997 | case Opt_fmask: | 997 | case Opt_fmask: |
998 | if (match_octal(&args[0], &option)) | 998 | if (match_octal(&args[0], &option)) |
999 | return 0; | 999 | return -EINVAL; |
1000 | opts->fs_fmask = option; | 1000 | opts->fs_fmask = option; |
1001 | break; | 1001 | break; |
1002 | case Opt_allow_utime: | 1002 | case Opt_allow_utime: |
1003 | if (match_octal(&args[0], &option)) | 1003 | if (match_octal(&args[0], &option)) |
1004 | return 0; | 1004 | return -EINVAL; |
1005 | opts->allow_utime = option & (S_IWGRP | S_IWOTH); | 1005 | opts->allow_utime = option & (S_IWGRP | S_IWOTH); |
1006 | break; | 1006 | break; |
1007 | case Opt_codepage: | 1007 | case Opt_codepage: |
1008 | if (match_int(&args[0], &option)) | 1008 | if (match_int(&args[0], &option)) |
1009 | return 0; | 1009 | return -EINVAL; |
1010 | opts->codepage = option; | 1010 | opts->codepage = option; |
1011 | break; | 1011 | break; |
1012 | case Opt_flush: | 1012 | case Opt_flush: |
@@ -1014,9 +1014,9 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, | |||
1014 | break; | 1014 | break; |
1015 | case Opt_time_offset: | 1015 | case Opt_time_offset: |
1016 | if (match_int(&args[0], &option)) | 1016 | if (match_int(&args[0], &option)) |
1017 | return 0; | 1017 | return -EINVAL; |
1018 | if (option < -12 * 60 || option > 12 * 60) | 1018 | if (option < -12 * 60 || option > 12 * 60) |
1019 | return 0; | 1019 | return -EINVAL; |
1020 | opts->tz_set = 1; | 1020 | opts->tz_set = 1; |
1021 | opts->time_offset = option; | 1021 | opts->time_offset = option; |
1022 | break; | 1022 | break; |