summaryrefslogtreecommitdiffstats
path: root/fs/ext2/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/balloc.c')
-rw-r--r--fs/ext2/balloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 547c165299c0..92e9a7489174 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -1203,13 +1203,13 @@ int ext2_data_block_valid(struct ext2_sb_info *sbi, ext2_fsblk_t start_blk,
1203 unsigned int count) 1203 unsigned int count)
1204{ 1204{
1205 if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || 1205 if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
1206 (start_blk + count < start_blk) || 1206 (start_blk + count - 1 < start_blk) ||
1207 (start_blk > le32_to_cpu(sbi->s_es->s_blocks_count))) 1207 (start_blk + count - 1 >= le32_to_cpu(sbi->s_es->s_blocks_count)))
1208 return 0; 1208 return 0;
1209 1209
1210 /* Ensure we do not step over superblock */ 1210 /* Ensure we do not step over superblock */
1211 if ((start_blk <= sbi->s_sb_block) && 1211 if ((start_blk <= sbi->s_sb_block) &&
1212 (start_blk + count >= sbi->s_sb_block)) 1212 (start_blk + count - 1 >= sbi->s_sb_block))
1213 return 0; 1213 return 0;
1214 1214
1215 return 1; 1215 return 1;