diff options
Diffstat (limited to 'fs/ext4/ext4fs.c')
-rw-r--r-- | fs/ext4/ext4fs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 51944b61bd0..9be99594f50 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -103,16 +103,20 @@ int ext4fs_read_file(struct ext2fs_node *node, loff_t pos, for (i = lldiv(pos, blocksize); i < blockcnt; i++) { lbaint_t blknr; + long blknr_and_status; int blockoff = pos - (blocksize * i); int blockend = blocksize; int skipfirst = 0; - blknr = read_allocated_block(&node->inode, i, &cache); - if (blknr < 0) { + blknr_and_status = read_allocated_block(&node->inode, i, &cache); + if (blknr_and_status < 0) { ext_cache_fini(&cache); return -1; } - blknr = blknr << log2_fs_blocksize; + /* Block number could becomes very large when CONFIG_SYS_64BIT_LBA is enabled + * and wrap around at max long int + */ + blknr = (lbaint_t)blknr_and_status << log2_fs_blocksize; /* Last block. */ if (i == blockcnt - 1) { |