From 00ea586fb23f88da616c27d66faf210532c12b5a Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 3 Oct 2011 23:47:19 -0400 Subject: [PATCH] libext2fs: fix bad cast which causes problems for file systems > 512EB If the number of block groups exceeds 2**32, a bad cast would lead to a bogus "Not enough space to build proposed filesystem while setting up superblock" failure. Signed-off-by: "Theodore Ts'o" --- lib/ext2fs/initialize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index 2875f97e..b050a0a9 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -248,7 +248,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, } retry: - fs->group_desc_count = (blk_t) ext2fs_div64_ceil( + fs->group_desc_count = (dgrp_t) ext2fs_div64_ceil( ext2fs_blocks_count(super) - super->s_first_data_block, EXT2_BLOCKS_PER_GROUP(super)); if (fs->group_desc_count == 0) { -- 2.11.0