]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
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 1ed98aa437fe185c97ebbbc6ec7a6a24779ec35d..65c45c512bbcf5e21b23819cda51e036e143779f 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);