[PATCH] 3/6 Avoid overflow in calculation of resvd blocks in resized fs
Eric Sandeen <[email protected]> Wed, 16 Aug 2006 15:51:50 -0500
| Newsgroups | gmane.comp.file-systems.ext2.devel |
|---|---|
| Message-ID | <[email protected]> |
The way the new reserved blocks count was calculated at resize time could overflow pretty easily. The new calculation changes the rounding slightly, so fix up the expected output for the resize tests as well. Signed-off-by: Eric Sandeen <[email protected]> Index: e2fsprogs-1.39-test/resize/resize2fs.c =================================================================== --- e2fsprogs-1.39-test.orig/resize/resize2fs.c +++ e2fsprogs-1.39-test/resize/resize2fs.c @@ -246,8 +246,8 @@ retry: */ blk = old_fs->super->s_r_blocks_count * 100 / old_fs->super->s_blocks_count; - fs->super->s_r_blocks_count = ((fs->super->s_blocks_count * blk) - / 100); + fs->super->s_r_blocks_count = ((fs->super->s_blocks_count / 100) + * blk); /* * Adjust the bitmaps for size Index: e2fsprogs-1.39-test/tests/r_move_itable/expect =================================================================== --- e2fsprogs-1.39-test.orig/tests/r_move_itable/expect +++ e2fsprogs-1.39-test/tests/r_move_itable/expect @@ -25,7 +25,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 1248 Block count: 9985 -Reserved block count: 399 +Reserved block count: 396 Free blocks: 8704 Free inodes: 1237 First block: 1 @@ -326,7 +326,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 2496 Block count: 19969 -Reserved block count: 599 +Reserved block count: 597 Free blocks: 18325 Free inodes: 2485 First block: 1 @@ -863,7 +863,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 3744 Block count: 29953 -Reserved block count: 599 +Reserved block count: 598 Free blocks: 27946 Free inodes: 3733 First block: 1 Index: e2fsprogs-1.39-test/tests/r_resize_inode/expect =================================================================== --- e2fsprogs-1.39-test.orig/tests/r_resize_inode/expect +++ e2fsprogs-1.39-test/tests/r_resize_inode/expect @@ -23,7 +23,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 16384 Block count: 65536 -Reserved block count: 2621 +Reserved block count: 2620 Free blocks: 61023 Free inodes: 16373 First block: 1 @@ -471,7 +471,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 4096 Block count: 16384 -Reserved block count: 655 +Reserved block count: 652 Free blocks: 14277 Free inodes: 4085 First block: 1 @@ -628,7 +628,7 @@ Errors behavior: Continue Filesystem OS type: Linux Inode count: 41472 Block count: 165536 -Reserved block count: 4966 +Reserved block count: 4965 Free blocks: 157175 Free inodes: 41461 First block: 1 ------------------------------------------------------------------------- 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