Whamcloud - gitweb
mke2fs: fix check for absurdly large devices
authorAndreas Dilger <adilger@dilger.ca>
Sun, 5 May 2019 22:33:46 +0000 (18:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 6 May 2019 14:15:41 +0000 (10:15 -0400)
commitf6cf3e61932596c8d00e170d69ae2529f3a8dc81
tree775ab72f3bacdf21d9bb2ee0d852b3434275d6a7
parentd0efd17a436aacda85aae86bb6dfed4226a9e0a9
mke2fs: fix check for absurdly large devices

The check in mke2fs is intended to be for the number of blocks in the
filesystem exceeding the maximum number of addressable blocks in 2^32
bitmaps, which is (2^32 * 8 bits/byte * blocksize) = 2^47 blocks,
or 2^59 bytes = 512PiB for the common 4KiB blocksize.

However, s_log_blocksize holds log2(blocksize_in_kb), so the current
calculation is a factor of 2^10 too small.  This caused mke2fs to fail
while trying to format a 900TB filesystem.

Fixes: 101ef2e93c25 ("mke2fs: Avoid crashes / infinite loops for absurdly large devices")
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c