All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Valerie Aurora Henson <vaurora@redhat.com>
Cc: Andreas Dilger <adilger@sun.com>, linux-ext4@vger.kernel.org
Subject: Re: [RFC PATCH 10/17] signed int -> blk64_t to fix bugs at 2^31 - 2^32 blocks
Date: Sun, 16 Nov 2008 10:06:51 -0500	[thread overview]
Message-ID: <20081116150651.GC9987@mit.edu> (raw)
In-Reply-To: <20081114023812.GD20637@shell>

I've just checked the following into e2fsprogs git tree.

     	  	      		     	       - Ted

commit a057b2332f5780b71018630f18f2619480118c5d
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Sun Nov 16 10:03:00 2008 -0500

    Fix various signed/unsigned gcc warnings
    
    Some of these could affect filesystems between 2^31 and 2^32-1 blocks.
    
    Thanks to Valerie Aurora Henson for pointing out the problems in
    lib/ext2fs/alloc_tables.c, which led me to do a "make gcc-wall"
    scan over the source tree.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 8ad0871..3e1a94d 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -404,7 +404,7 @@ static void check_is_really_dir(e2fsck_t ctx, struct problem_context *pctx,
 	const char		*old_op;
 	errcode_t		retval;
 	blk_t			blk;
-	int			i, rec_len, not_device = 0;
+	unsigned int		i, rec_len, not_device = 0;
 
 	if (LINUX_S_ISDIR(inode->i_mode) || LINUX_S_ISREG(inode->i_mode) ||
 	    LINUX_S_ISLNK(inode->i_mode) || inode->i_block[0] == 0)
@@ -1935,7 +1935,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
 			bad_size = 4;
 		else if ((extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) &&
 			 size >
-			 ((1LL << (32 + EXT2_BLOCK_SIZE_BITS(fs->super))) - 1))
+			 ((1ULL << (32 + EXT2_BLOCK_SIZE_BITS(fs->super))) - 1))
 			/* too big for an extent-based file - 32bit ee_block */
 			bad_size = 6;
 	}
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index c36bfcf..f479df6 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -717,7 +717,7 @@ static int check_dir_block(ext2_filsys fs,
 	const char *		old_op;
 	int			dir_modified = 0;
 	int			dot_state;
-	int			rec_len;
+	unsigned int		rec_len;
 	blk_t			block_nr = db->blk;
 	ext2_ino_t 		ino = db->ino;
 	ext2_ino_t 		subdir_parent;
@@ -855,7 +855,7 @@ out_htree:
 		if (((offset + rec_len) > fs->blocksize) ||
 		    (rec_len < 12) ||
 		    ((rec_len % 4) != 0) ||
-		    (((dirent->name_len & 0xFF)+8) > rec_len)) {
+		    (((dirent->name_len & (unsigned) 0xFF)+8) > rec_len)) {
 			if (fix_problem(ctx, PR_2_DIR_CORRUPTED, &cd->pctx)) {
 				salvage_directory(fs, dirent, prev, &offset);
 				dir_modified++;
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 230bec9..be2b56b 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -29,10 +29,10 @@
 /*
  * Check for uninit block bitmaps and deal with them appropriately
  */
-static check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
+static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
 			  dgrp_t group)
 {
-	int		i;
+	blk_t		i;
 	blk_t		blk, super_blk, old_desc_blk, new_desc_blk;
 	int		old_desc_blocks;
 
@@ -75,11 +75,10 @@ static check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
 /*
  * Check for uninit inode bitmaps and deal with them appropriately
  */
-static check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map,
+static void check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map,
 			  dgrp_t group)
 {
-	int		i;
-	ext2_ino_t	ino;
+	ext2_ino_t	i, ino;
 
 	if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
 					 EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) ||
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 4d2535e..9b4c057 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -119,7 +119,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
 		start_blk = group_blk;
 
 	if (flexbg_size) {
-		int prev_block = 0;
+		blk_t prev_block = 0;
 		if (group && fs->group_desc[group-1].bg_block_bitmap)
 			prev_block = fs->group_desc[group-1].bg_block_bitmap;
 		start_blk = flexbg_offset(fs, group, prev_block, bmap,
@@ -147,7 +147,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
 	}
 
 	if (flexbg_size) {
-		int prev_block = 0;
+		blk_t prev_block = 0;
 		if (group && fs->group_desc[group-1].bg_inode_bitmap)
 			prev_block = fs->group_desc[group-1].bg_inode_bitmap;
 		start_blk = flexbg_offset(fs, group, prev_block, bmap,
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index b75cb77..b3ac9f2 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -17,6 +17,7 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#include <time.h>
 #if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index f392867..abe05f5 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -176,8 +176,7 @@ errout:
  */
 static void fix_uninit_block_bitmaps(ext2_filsys fs)
 {
-	int		i;
-	blk_t		blk, super_blk, old_desc_blk, new_desc_blk;
+	blk_t		i, blk, super_blk, old_desc_blk, new_desc_blk;
 	int		old_desc_blocks;
 	dgrp_t		g;
 
@@ -1375,8 +1374,8 @@ errout:
 struct istruct {
 	ext2_resize_t rfs;
 	errcode_t	err;
-	unsigned long	max_dirs;
-	int		num;
+	unsigned int	max_dirs;
+	unsigned int	num;
 };
 
 static int check_and_change_inodes(ext2_ino_t dir,

  parent reply	other threads:[~2008-11-16 16:33 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12  3:42 [RFC,PATCH] 64-bit support for e2fsprogs Valerie Aurora Henson
2008-11-12  3:42 ` [RFC PATCH 01/17] Disable tst_refcount - doesn't compile, don't know why Valerie Aurora Henson
2008-11-12  3:42   ` [RFC PATCH 02/17] Squash warnings Valerie Aurora Henson
2008-11-12  3:42     ` [RFC PATCH 03/17] Add 64-bit bitops Valerie Aurora Henson
2008-11-12  3:42       ` [RFC PATCH 04/17] Implement 64-bit "bitarray" bmap ops Valerie Aurora Henson
2008-11-12  3:42         ` [RFC PATCH 05/17] Convert libext2fs to 64-bit bitmap interface Valerie Aurora Henson
2008-11-12  3:42           ` [RFC PATCH 06/17] Convert mke2fs to new " Valerie Aurora Henson
2008-11-12  3:43             ` [RFC PATCH 07/17] Convert e2fsck " Valerie Aurora Henson
2008-11-12  3:43               ` [RFC PATCH 08/17] Turn on new bitmaps in e2fsck and mke2fs Valerie Aurora Henson
2008-11-12  3:43                 ` [RFC PATCH 09/17] Add progress bar for allocating block tables - takes forever on large Valerie Aurora Henson
2008-11-12  3:43                   ` [RFC PATCH 10/17] signed int -> blk64_t to fix bugs at 2^31 - 2^32 blocks Valerie Aurora Henson
2008-11-12  3:43                     ` [RFC PATCH 11/17] Fix overflow in calculation of total file system blocks Valerie Aurora Henson
2008-11-12  3:43                       ` [RFC PATCH 12/17] Add ext2fs_block_iterate3 (from Ted) Valerie Aurora Henson
2008-11-12  3:43                         ` [RFC PATCH 13/17] Support 48-bit file acl blocks Valerie Aurora Henson
2008-11-12  3:43                           ` [RFC PATCH 14/17] super->s_*_blocks_count -> ext2fs_*_blocks_count() Valerie Aurora Henson
2008-11-12  3:43                             ` [RFC PATCH 15/17] Convert to inode/block/bitmap/table loc()/loc_set() functions Valerie Aurora Henson
2008-11-12  3:43                               ` [RFC PATCH 16/17] ext2fs_block_alloc_stats -> ext2fs_block_alloc_stats2 Valerie Aurora Henson
2008-11-12  3:43                                 ` [RFC PATCH 17/17] Convert to 64-bit IO Valerie Aurora Henson
2008-11-13 20:26                               ` [RFC PATCH 15/17] Convert to inode/block/bitmap/table loc()/loc_set() functions Andreas Dilger
2008-11-13 20:24                             ` [RFC PATCH 14/17] super->s_*_blocks_count -> ext2fs_*_blocks_count() Andreas Dilger
2008-11-14  3:25                               ` Valerie Aurora Henson
2008-11-14 16:24                                 ` Eric Sandeen
2008-11-13 20:14                           ` [RFC PATCH 13/17] Support 48-bit file acl blocks Andreas Dilger
2008-11-14  2:30                             ` Valerie Aurora Henson
2008-11-13 20:04                       ` [RFC PATCH 11/17] Fix overflow in calculation of total file system blocks Andreas Dilger
2008-11-14  2:34                         ` Valerie Aurora Henson
2008-11-14  3:10                         ` 64-bit inode support in e2fsprogs? (was Re: [RFC PATCH 11/17] Fix overflow in calculation of total file system blocks) Valerie Aurora Henson
2008-11-14 20:32                           ` Andreas Dilger
2008-11-13 19:57                     ` [RFC PATCH 10/17] signed int -> blk64_t to fix bugs at 2^31 - 2^32 blocks Andreas Dilger
2008-11-14  2:38                       ` Valerie Aurora Henson
2008-11-14  3:42                         ` Eric Sandeen
2008-11-14  3:54                           ` Valerie Aurora Henson
2008-11-14  4:04                             ` Eric Sandeen
2008-11-14 14:24                         ` Theodore Tso
2008-11-14 20:35                           ` Andreas Dilger
2008-11-16 15:06                         ` Theodore Tso [this message]
2008-11-13 19:54                   ` [RFC PATCH 09/17] Add progress bar for allocating block tables - takes forever on large Andreas Dilger
2008-11-14  2:45                     ` Valerie Aurora Henson
2008-11-12 20:47         ` [RFC PATCH 04/17] Implement 64-bit "bitarray" bmap ops Andreas Dilger
2008-11-14  2:59           ` Valerie Aurora Henson
2008-11-12 20:25 ` [RFC,PATCH] 64-bit support for e2fsprogs Andreas Dilger
2008-11-13 20:30   ` Theodore Tso
2008-11-14  3:01     ` Valerie Aurora Henson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081116150651.GC9987@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger@sun.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=vaurora@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.