From f23a1b7f48ec471068de70a9124d46aaec6de6bb Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 22 Jun 2018 22:33:39 -0400 Subject: [PATCH] libext2fs: fix uninitialized variable dereference in extent_bmap() 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 --- lib/ext2fs/bmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index 1ed98aa..65c45c5 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -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); -- 1.8.3.1