Even though we don't have support for filesystems with over 4B inodes
in the current e2fsprogs, this may happen in the future. There are
latent overflow bugs when calculating the number of inodes in the
filesystem that can trivially be fixed now, rather than waiting for
them to be hit at some point in the future. The block number calcs
are already correct in this code.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
clear_problem_context(&pctx);
- end = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
+ end = (__u64)EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
pctx.errcode = ext2fs_fudge_inode_bitmap_end(fs->inode_map, end,
&save_inodes_count);
if (pctx.errcode) {
start = 1;
end = fs->super->s_inodes_count;
- real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
+ real_end = (__u64)EXT2_INODES_PER_GROUP(fs->super) *
+ fs->group_desc_count;
/* Are we permitted to use new-style bitmaps? */
if (fs->flags & EXT2_FLAG_64BITS)
}
bmap = fs->inode_map;
itr = 1;
- cnt = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = (__u64)EXT2_INODES_PER_GROUP(fs->super) *
+ fs->group_desc_count;
size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
} else {
if (!fs->block_map) {
}
bmap = fs->inode_map;
itr = 1;
- cnt = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count;
+ cnt = (__u64)EXT2_INODES_PER_GROUP(fs->super) *
+ fs->group_desc_count;
size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
} else {
if (!fs->block_map) {
overhead = 0;
else
overhead = fs->desc_blocks +
- fs->group_desc_count *
+ (blk64_t)fs->group_desc_count *
(fs->inode_blocks_per_group + 2);
reserved = ext2fs_r_blocks_count(fs->super);
if (!reserved)