Whamcloud - gitweb
resize2fs: fix free blocks count sanity check for 64-bit file systems
authorTheodore Ts'o <tytso@mit.edu>
Thu, 2 Nov 2017 13:36:37 +0000 (09:36 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 2 Nov 2017 13:36:37 +0000 (09:36 -0400)
The sanity check that the free blocks count is not insane could fail
with a false positive on 64-bit file systems.  Fix it.

Reported-by: Ian Astle <iastle@ott-fortimail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
resize/main.c

index ba6bb6b..aa16077 100644 (file)
@@ -440,7 +440,8 @@ int main (int argc, char ** argv)
                    !print_min_size)
                        checkit = 1;
 
-               if ((fs->super->s_free_blocks_count > fs->super->s_blocks_count) ||
+               if ((ext2fs_free_blocks_count(fs->super) >
+                    ext2fs_blocks_count(fs->super)) ||
                    (fs->super->s_free_inodes_count > fs->super->s_inodes_count))
                        checkit = 1;