|
@@ -3412,12 +3412,16 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
|
|
{
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
|
|
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
|
|
unsigned int blkbits = inode->i_blkbits;
|
|
unsigned int blkbits = inode->i_blkbits;
|
|
- unsigned long first_block = offset >> blkbits;
|
|
|
|
- unsigned long last_block = (offset + length - 1) >> blkbits;
|
|
|
|
|
|
+ unsigned long first_block, last_block;
|
|
struct ext4_map_blocks map;
|
|
struct ext4_map_blocks map;
|
|
bool delalloc = false;
|
|
bool delalloc = false;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
|
+ if ((offset >> blkbits) > EXT4_MAX_LOGICAL_BLOCK)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ first_block = offset >> blkbits;
|
|
|
|
+ last_block = min_t(loff_t, (offset + length - 1) >> blkbits,
|
|
|
|
+ EXT4_MAX_LOGICAL_BLOCK);
|
|
|
|
|
|
if (flags & IOMAP_REPORT) {
|
|
if (flags & IOMAP_REPORT) {
|
|
if (ext4_has_inline_data(inode)) {
|
|
if (ext4_has_inline_data(inode)) {
|