Whamcloud - gitweb
libext2fs: fix uninitialized variable dereference in extent_bmap()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2018 02:33:39 +0000 (22:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2018 02:44:47 +0000 (22:44 -0400)
The code path was failing to initialize the logial block number hint
in the allocation context.  It's not currently being used, but it
might be in the future, and it trips warnings in static code
analyzers.

Fixes-Coverity-Bug: 709545
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/bmap.c

index 1ed98aa..65c45c5 100644 (file)
@@ -225,8 +225,10 @@ static errcode_t extent_bmap(ext2_filsys fs, ext2_ino_t ino,
        retval = ext2fs_extent_goto(handle, block);
        if (retval) {
                /* If the extent is not found, return phys_blk = 0 */
-               if (retval == EXT2_ET_EXTENT_NOT_FOUND)
+               if (retval == EXT2_ET_EXTENT_NOT_FOUND) {
+                       extent.e_lblk = block;
                        goto got_block;
+               }
                return retval;
        }
        retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);