f2fs: fix incorrect parsing with option string
authorChao Yu <chao2.yu@samsung.com>
Tue, 18 Mar 2014 01:07:59 +0000 (09:07 +0800)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Tue, 18 Mar 2014 01:13:02 +0000 (10:13 +0900)
Previously 'background_gc={on***,off***}' is being parsed as correct option,
with this patch we cloud fix the trivial bug in mount process.

Change log from v1:
 o need to check length of parameter suggested by Jaegeuk Kim.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/super.c

index 057a3ef..dbe402b 100644 (file)
@@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)
 
                        if (!name)
                                return -ENOMEM;
-                       if (!strncmp(name, "on", 2))
+                       if (strlen(name) == 2 && !strncmp(name, "on", 2))
                                set_opt(sbi, BG_GC);
-                       else if (!strncmp(name, "off", 3))
+                       else if (strlen(name) == 3 && !strncmp(name, "off", 3))
                                clear_opt(sbi, BG_GC);
                        else {
                                kfree(name);