From b82f6e347bfb68920d7e611553e1f3170ee4608c Mon Sep 17 00:00:00 2001 From: Yunlei He Date: Tue, 24 Apr 2018 11:40:30 +0800 Subject: [PATCH] f2fs: move mnt_want_write_file after range check This patch move mnt_want_write_file after range check, it's needless to check arguments with it. Signed-off-by: Yunlei He Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a68b2cc067bc..10668720a661 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2061,15 +2061,15 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) if (f2fs_readonly(sbi->sb)) return -EROFS; + end = range.start + range.len; + if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) { + return -EINVAL; + } + ret = mnt_want_write_file(filp); if (ret) return ret; - end = range.start + range.len; - if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) { - ret = -EINVAL; - goto out; - } do_more: if (!range.sync) { if (!mutex_trylock(&sbi->gc_mutex)) { -- 2.30.2