summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@zoho.com.cn>2019-07-23 19:21:55 +0800
committerJan Kara <jack@suse.cz>2019-07-31 12:04:42 +0200
commitb6aeffc5852f39db6e6e56da5327d0c43ac3c30a (patch)
tree7c2fa853f803c8d27734c118e004106d582a9424 /fs/ext2
parente5d395974e043cdcedcd84a0d41aaebb723786d8 (diff)
downloadlinux-riscv-b6aeffc5852f39db6e6e56da5327d0c43ac3c30a.tar.gz
linux-riscv-b6aeffc5852f39db6e6e56da5327d0c43ac3c30a.tar.bz2
linux-riscv-b6aeffc5852f39db6e6e56da5327d0c43ac3c30a.zip
ext2: code cleanup for ext2_free_blocks()
Call ext2_data_block_valid() for block range validity. Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn> Link: https://lore.kernel.org/r/20190723112155.20329-2-cgxu519@zoho.com.cn Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/balloc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 92e9a7489174..e0cc55164505 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -490,9 +490,7 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
struct ext2_super_block * es = sbi->s_es;
unsigned freed = 0, group_freed;
- if (block < le32_to_cpu(es->s_first_data_block) ||
- block + count < block ||
- block + count > le32_to_cpu(es->s_blocks_count)) {
+ if (!ext2_data_block_valid(sbi, block, count)) {
ext2_error (sb, "ext2_free_blocks",
"Freeing blocks not in datazone - "
"block = %lu, count = %lu", block, count);