rfc: [patch 4/6] more e2fsprogs fixes

Alexandre Ratchov <[email protected]> Fri, 25 Aug 2006 15:19:51 +0200
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
replace __u32 -> blk_t to avoid overflow in
check_super_block(), also changes 0 -> 0ULL in order to
avoid compiler warnings

Index: e2fsprogs-1.39/e2fsck/super.c
===================================================================
--- e2fsprogs-1.39.orig/e2fsck/super.c	2006-08-22 15:49:32.000000000 +0200
+++ e2fsprogs-1.39/e2fsck/super.c	2006-08-24 16:18:00.000000000 +0200
@@ -450,7 +450,8 @@ void check_super_block(e2fsck_t ctx)
 	dgrp_t	i;
 	blk_t	should_be;
 	struct problem_context	pctx;
-	__u32	free_blocks = 0, free_inodes = 0;
+	blk_t	free_blocks = 0;
+	ino_t	free_inodes = 0;
 
 	inodes_per_block = EXT2_INODES_PER_BLOCK(fs->super);
 	ipg_max = inodes_per_block * (blocks_per_group - 4);
@@ -577,7 +578,7 @@ void check_super_block(e2fsck_t ctx)
 		    (EXT2_BLOCK_BITMAP(gd, first_block) >= last_block)) {
 			pctx.blk = EXT2_BLOCK_BITMAP(gd, first_block);
 			if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx))
-				EXT2_BLOCK_BITMAP_SET(gd, 0, 0);
+				EXT2_BLOCK_BITMAP_SET(gd, 0, 0ULL);
 		}
 		if (!EXT2_IS_USED_BLOCK_BITMAP(gd)) {
 			ctx->invalid_block_bitmap_flag[i]++;
@@ -587,7 +588,7 @@ void check_super_block(e2fsck_t ctx)
 		    (EXT2_INODE_BITMAP(gd, first_block)>= last_block)) {
 			pctx.blk = EXT2_INODE_BITMAP(gd, first_block);
 			if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx))
-				EXT2_INODE_BITMAP_SET(gd, 0, 0);
+				EXT2_INODE_BITMAP_SET(gd, 0, 0ULL);
 		}
 		if (!EXT2_IS_USED_INODE_BITMAP(gd)) {
 			ctx->invalid_inode_bitmap_flag[i]++;
@@ -598,7 +599,7 @@ void check_super_block(e2fsck_t ctx)
 		      fs->inode_blocks_per_group - 1) >= last_block)) {
 			pctx.blk = EXT2_INODE_TABLE(gd, first_block);
 			if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx))
-				EXT2_INODE_TABLE_SET(gd, 0, 0);
+				EXT2_INODE_TABLE_SET(gd, 0, 0ULL);
 		}
 		if (!EXT2_IS_USED_INODE_TABLE(gd)) {
 			ctx->invalid_inode_table_flag[i]++;

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642