Commit 04c0938844695ab97b79a477a9f57748fe97d2f5

Authored by Chao Yu
Committed by Jaegeuk Kim
1 parent e4fc5fbfc9

f2fs: fix incorrect parsing with option string

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>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -258,9 +258,9 @@
258 258  
259 259 if (!name)
260 260 return -ENOMEM;
261   - if (!strncmp(name, "on", 2))
  261 + if (strlen(name) == 2 && !strncmp(name, "on", 2))
262 262 set_opt(sbi, BG_GC);
263   - else if (!strncmp(name, "off", 3))
  263 + else if (strlen(name) == 3 && !strncmp(name, "off", 3))
264 264 clear_opt(sbi, BG_GC);
265 265 else {
266 266 kfree(name);