]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix more rounding overflows for filesystems that have 2**32-1 blocks
authorEric Sandeen <esandeen@redhat.com>
Tue, 12 Sep 2006 18:56:18 +0000 (14:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 12 Sep 2006 18:56:18 +0000 (14:56 -0400)
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
e2fsck/ChangeLog
e2fsck/pass1.c
misc/ChangeLog
misc/mke2fs.c
resize/ChangeLog
resize/online.c
resize/resize2fs.c

index 94bdf2f243ebc5e97383fd8dc9d38473261839bc..e87d7a87c383b637393481a26ce4151d64487bca 100644 (file)
@@ -1,3 +1,7 @@
+2006-08-30  Eric Sandeen <esandeen@redhat.com>
+
+       * pass1.c (handle_bad_fs_blocks): use blk_t, not int for first_block.
+
 2006-08-30  Eric Sandeen <esandeen@redhat.com>
 
        * unix.c (show_stats): use ext2_ino_t for inode containers.
index e6778af1f176dad98eb0c8c2225d3823a9cab61a..9a84b783a5cc6db86f139ae86799e4a5670e1f34 100644 (file)
@@ -1953,7 +1953,7 @@ static void handle_fs_bad_blocks(e2fsck_t ctx)
 {
        ext2_filsys fs = ctx->fs;
        dgrp_t          i;
-       int             first_block;
+       blk_t           first_block;
 
        for (i = 0; i < fs->group_desc_count; i++) {
                first_block = ext2fs_group_first_block(fs, i);
index f59d471ba20015da6b2c0fdc6ad9dfb7f20e52a3..93cd1edf1b6c25ea42b67220a2c6f4ed714d7e33 100644 (file)
@@ -1,3 +1,7 @@
+2006-08-30  Eric Sandeen <esandeen@redhat.com>
+
+       * mke2fs.c (PRS): Avoid overflow in megs calculation.
+
 2006-08-30  Eric Sandeen <esandeen@redhat.com>
 
        * mke2fs.c (PRS): Disallow > 2^32 inodes at mkfs time.
index 256c8133e12ceecdeb6e804651cc52ed1b66ab74..87ae687050f7942c08650fb44982f65e10e02877 100644 (file)
@@ -1260,7 +1260,7 @@ static void PRS(int argc, char *argv[])
        }
 
        if (!fs_type) {
-               int megs = fs_param.s_blocks_count * 
+               int megs = (__u64)fs_param.s_blocks_count *
                        (EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024;
 
                if (megs <= 3)
index b740df0fd9c75cf18a3a2e06a94c9405817d2085..bc4dd92c4ab2f67b840ed9da541a736f2e4a2d96 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-30  Eric Sandeen  <esandeen@redhat.com>
+
+       * online.c (online_resize_fs): use div_ceil for r_frac calculation.
+       * resize2fs.c (adjust_fs_info): avoid overflow in blk calculation
+               when figuring new reserved blocks count.
+
 2006-08-30  Eric Sandeen  <esandeen@redhat.com>
 
        * resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time.
index 26b263e767eab6d8725d83fc1bc3125f34d83038..a1c19c3e989034188be6599ab07a9861add0d128 100644 (file)
@@ -59,8 +59,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
                exit(1);
        }
 
-       r_frac = ((100 * sb->s_r_blocks_count) + sb->s_blocks_count-1) /
-               sb->s_blocks_count;
+       r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count);
 
        retval = ext2fs_read_bitmaps(fs);
        if (retval)
index 60180abbbd74f7877893ab9e50614cdd480c4195..e1057eca11c9f60727770d0af4abf0d50b7a784d 100644 (file)
@@ -250,7 +250,7 @@ retry:
        /*
         * Adjust the number of reserved blocks
         */
-       blk = old_fs->super->s_r_blocks_count * 100 /
+       blk = (__u64)old_fs->super->s_r_blocks_count * 100 /
                old_fs->super->s_blocks_count;
        fs->super->s_r_blocks_count = e2p_percent(blk, 
                                                  fs->super->s_blocks_count);