Whamcloud - gitweb
e2fsck: fix pass5 optimization for bigalloc file systems
authorTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2012 03:32:23 +0000 (22:32 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2012 03:32:23 +0000 (22:32 -0500)
Commit 53e3120c18 introduced a regression which would case e2fsck to
overrun an array boundary for bigalloc file systems, and most likely
crash.  Fix this by correctly using blocks instead of clusters when
incrementing the loop counter in the fast path optimization case.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/pass5.c

index 5aff55c..fce0f6e 100644 (file)
@@ -306,7 +306,7 @@ redo_counts:
                n = ext2fs_bitcount(actual_buf, nbytes);
                group_free = fs->super->s_clusters_per_group - n;
                free_blocks += group_free;
-               i += fs->super->s_clusters_per_group - 1;
+               i += EXT2FS_C2B(fs, fs->super->s_clusters_per_group - 1);
                goto next_group;
        no_optimize: