Whamcloud - gitweb
libext2fs: copy cluster_bits in ext2fs_copy_generic_bmap
authorEric Sandeen <sandeen@redhat.com>
Wed, 10 Aug 2011 19:07:41 +0000 (14:07 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Aug 2011 01:49:38 +0000 (21:49 -0400)
commit9c79612f2186a8ee5d8a6f2c961e4e0f63df7228
tree7c9032fcf94a9ab2067ecf38eb0e09a9d4ec3313
parentd4c0d8e5b858cdf3d3000f2b3fca532787f34a02
libext2fs: copy cluster_bits in ext2fs_copy_generic_bmap

The f_lotsbad regression test was failing on some systems
with:

 Restarting e2fsck from the beginning...
 Pass 1: Checking inodes, blocks, and sizes
+Illegal block number passed to ext2fs_test_block_bitmap #0 for in-use block map
 Pass 2: Checking directory structure
 Entry 'termcap' in / (2) has deleted/unused inode 12.  Clear? yes

Running with valgrind (./test_script --valgrind f_lotsbad) we
see:

+==31409== Conditional jump or move depends on uninitialised value(s)
+==31409==    at 0x42927A: ext2fs_test_generic_bmap (gen_bitmap64.c:378)

among others.

Looking at gen_bitmap64.c:
376:        arg >>= bitmap->cluster_bits;
377:
378:        if ((arg < bitmap->start) || (arg > bitmap->end)) {

A little more debugging showed that it was actually
bitmap->cluster_bits which was uninitialized, because it never
gets copied over in ext2fs_copy_generic_bmap()

Patch below resolves the issue.

Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/gen_bitmap64.c