Skip to content

Commit

Permalink
ext2: fix possible integer truncation in ext2_iomap_begin
Browse files Browse the repository at this point in the history
For 32-bit architectures we need to cast first_block to u64 before
shifting it left.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Christoph Hellwig authored and Dave Chinner committed Oct 2, 2016
1 parent 25f4e70 commit d5bfccd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,

iomap->flags = 0;
iomap->bdev = inode->i_sb->s_bdev;
iomap->offset = first_block << blkbits;
iomap->offset = (u64)first_block << blkbits;

if (ret == 0) {
iomap->type = IOMAP_HOLE;
Expand Down

0 comments on commit d5bfccd

Please sign in to comment.