diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 92214d4e5afa..c717a74f2178 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -607,7 +607,14 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
607 | if (*err) | 607 | if (*err) |
608 | goto failed_out; | 608 | goto failed_out; |
609 | 609 | ||
610 | BUG_ON(current_block + count > EXT4_MAX_BLOCK_FILE_PHYS); | 610 | if (unlikely(current_block + count > EXT4_MAX_BLOCK_FILE_PHYS)) { |
611 | EXT4_ERROR_INODE(inode, | ||
612 | "current_block %llu + count %lu > %d!", | ||
613 | current_block, count, | ||
614 | EXT4_MAX_BLOCK_FILE_PHYS); | ||
615 | *err = -EIO; | ||
616 | goto failed_out; | ||
617 | } | ||
611 | 618 | ||
612 | target -= count; | 619 | target -= count; |
613 | /* allocate blocks for indirect blocks */ | 620 | /* allocate blocks for indirect blocks */ |
@@ -643,7 +650,14 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
643 | ar.flags = EXT4_MB_HINT_DATA; | 650 | ar.flags = EXT4_MB_HINT_DATA; |
644 | 651 | ||
645 | current_block = ext4_mb_new_blocks(handle, &ar, err); | 652 | current_block = ext4_mb_new_blocks(handle, &ar, err); |
646 | BUG_ON(current_block + ar.len > EXT4_MAX_BLOCK_FILE_PHYS); | 653 | if (unlikely(current_block + ar.len > EXT4_MAX_BLOCK_FILE_PHYS)) { |
654 | EXT4_ERROR_INODE(inode, | ||
655 | "current_block %llu + ar.len %d > %d!", | ||
656 | current_block, ar.len, | ||
657 | EXT4_MAX_BLOCK_FILE_PHYS); | ||
658 | *err = -EIO; | ||
659 | goto failed_out; | ||
660 | } | ||
647 | 661 | ||
648 | if (*err && (target == blks)) { | 662 | if (*err && (target == blks)) { |
649 | /* | 663 | /* |