Whamcloud - gitweb
libext2fs: fix possible inode count overflow when creating fs
authorJan Kara <jack@suse.cz>
Tue, 19 Jun 2018 03:19:27 +0000 (23:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 19 Jun 2018 03:19:30 +0000 (23:19 -0400)
commit1071df83f969d64dd6dedf4f697da02e0889bf40
treee9fe40da85b431d2d06a6853101b9b467a914382
parentcedfcf2aeaee629392f04bac773d47f776ec1100
libext2fs: fix possible inode count overflow when creating fs

If blocks count is exactly 1<<32, then the code computing number of
inode count in ext2fs_initialize() will overflow and set number of
inodes to 0 (which will be later fixed up to EXT2_FIRST_INODE(super)+1).
Fix the off-by-one bug in the check.

Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/initialize.c