From: Theodore Ts'o Date: Wed, 24 Feb 2021 01:58:31 +0000 (-0500) Subject: debugfs: fix uninitialized variable es in do_logdump() X-Git-Tag: v1.46.2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fc56dd147fe7f1a4427f8caed10866e0255eea3;p=thirdparty%2Fe2fsprogs.git debugfs: fix uninitialized variable es in do_logdump() Fixes: d96064e9821a ("debugfs: simplify the do_logdump() function") Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/logdump.c b/debugfs/logdump.c index b747a92eb..10d413ba7 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -159,6 +159,7 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), if (!inode_to_dump) return; + es = current_fs->super; inode_group = ((inode_to_dump - 1) / es->s_inodes_per_group); group_offset = ((inode_to_dump - 1) @@ -189,7 +190,10 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), } } - if (block_to_dump != ANY_BLOCK && current_fs != NULL) { + if (block_to_dump != ANY_BLOCK) { + if (check_fs_open(argv[0])) + return; + es = current_fs->super; group_to_dump = ((block_to_dump - es->s_first_data_block) / es->s_blocks_per_group);