Skip to contentSkip to conversation

ext2: fix possible integer truncation in ext2_iomap_begin

PATCH New Christoph Hellwig 1 participant 1 message Sep 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext2: fix possible integer truncation in ext2_iomap_begin

For 32-bit architectures we need to cast first_block to u64 before shifting it left.

---
 fs/ext2/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext2/inode.c +1 -1
index aae5f61..c7dbb46 100644
@@ -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;
Signature · 1 line
2.1.4