From: Theodore Ts'o Date: Sat, 18 May 2002 03:37:42 +0000 (-0400) Subject: Fix fencepost error in allocating space for array. X-Git-Tag: E2FSPROGS-1.28-WIP-0626~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7823dd65722c50eeca98b2dde1c9a629e72fffe7;p=thirdparty%2Fe2fsprogs.git Fix fencepost error in allocating space for array. --- diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 8e048465d..d252bb7d3 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -103,7 +103,8 @@ struct scan_callback_struct { static struct process_inode_block *inodes_to_process; static int process_inode_count; -static __u64 ext2_max_sizes[EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE]; +static __u64 ext2_max_sizes[EXT2_MAX_BLOCK_LOG_SIZE - + EXT2_MIN_BLOCK_LOG_SIZE + 1]; /* * Free all memory allocated by pass1 in preparation for restarting @@ -273,7 +274,7 @@ void e2fsck_pass1(e2fsck_t ctx) max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i); max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i) * EXT2_BPP(i); max_sizes = (max_sizes * (1UL << i)) - 1; - ext2_max_sizes[i - 10] = max_sizes; + ext2_max_sizes[i - EXT2_MIN_BLOCK_LOG_SIZE] = max_sizes; } #undef EXT2_BPP