[RFC PATCH 11/17] Fix overflow in calculation of total file system blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Blocks per group and group desc count are both 32-bit; multiplied they
produce a 32-bit quantity which overflowed.

Signed-off-by: Valerie Aurora Henson <vaurora@xxxxxxxxxx>
---
 lib/ext2fs/bitmaps.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
index f438a8b..91dc7a1 100644
--- a/lib/ext2fs/bitmaps.c
+++ b/lib/ext2fs/bitmaps.c
@@ -92,8 +92,8 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
 
 	start = fs->super->s_first_data_block;
 	end = ext2fs_blocks_count(fs->super)-1;
-	real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)
-		    * fs->group_desc_count)-1 + start;
+	real_end = ((__u64) EXT2_BLOCKS_PER_GROUP(fs->super)
+		    * (__u64) fs->group_desc_count)-1 + start;
 
 	if (fs->flags & EXT2_FLAG_NEW_BITMAPS)
 		return (ext2fs_alloc_generic_bmap(fs,
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux