Whamcloud - gitweb
Fix 32/64-bit overflow when multiplying by blocks/clusters per group
authorTheodore Ts'o <tytso@mit.edu>
Sat, 26 Jul 2014 11:40:36 +0000 (07:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Jul 2014 11:40:36 +0000 (07:40 -0400)
commit1e33a8b408123a4e02a6b9135807f6fd61f3e235
tree7e63fafae965f736dce1e454077d10e51702cb4a
parentd4ecec45ab0d9d291bcac575988f68993ec98bd0
Fix 32/64-bit overflow when multiplying by blocks/clusters per group

There are a number of places where we need convert groups to blocks or
clusters by multiply the groups by blocks/clusters per group.
Unfortunately, both quantities are 32-bit, but the result needs to be
64-bit, and very often the cast to 64-bit gets lost.

Fix this by adding new macros, EXT2_GROUPS_TO_BLOCKS() and
EXT2_GROUPS_TO_CLUSTERS().

This should fix a bug where resizing a 64bit file system can result in
calculate_minimum_resize_size() looping forever.

Addresses-Launchpad-Bug: #1321958

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass5.c
e2fsck/super.c
lib/ext2fs/blknum.c
lib/ext2fs/ext2_fs.h
lib/ext2fs/imager.c
lib/ext2fs/rw_bitmaps.c
misc/tune2fs.c
resize/resize2fs.c