Skip to content

Commit

Permalink
ext2: code cleanup for ext2_free_blocks()
Browse files Browse the repository at this point in the history
Call ext2_data_block_valid() for block range validity.

Signed-off-by: Chengguang Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
Chengguang Xu authored and jankara committed Jul 31, 2019
1 parent e5d3959 commit b6aeffc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/ext2/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b6aeffc

Please sign in to comment.