diff options
author | Harshad Shirwadkar <harshadshirwadkar@gmail.com> | 2021-02-23 09:41:56 -0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-02-23 12:58:16 -0500 |
commit | 5ba3e1644c44572a9822aaa417cb3da69778d216 (patch) | |
tree | bb8b8d7159b399bddaa17363fe8fbffc7d29fa08 | |
parent | 11797844f48882506e1ca0b92e52b036391f3b32 (diff) | |
download | e2fsprogs-5ba3e1644c44572a9822aaa417cb3da69778d216.tar.gz |
e2fsck: initialize variable before first use in fast commit replay
Initialize ext2fs_ex variable in ext4_fc_replay_scan() before first
use. Also make sure ext2fs_decode_extent() completely overwrites the
extent structure passed to it as argument to prevent potential future
bugs for the users of the function.
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/journal.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/extent.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/e2fsck/journal.c b/e2fsck/journal.c index a67ef745..8e7ba819 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -289,7 +289,7 @@ static int ext4_fc_replay_scan(journal_t *j, struct buffer_head *bh, struct ext4_fc_tail *tail; __u8 *start, *end; struct ext4_fc_head *head; - struct ext2fs_extent ext2fs_ex; + struct ext2fs_extent ext2fs_ex = {0}; state = &ctx->fc_replay_state; diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index 9e611038..b324c7b0 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -1797,7 +1797,7 @@ errcode_t ext2fs_decode_extent(struct ext2fs_extent *to, void *addr, int len) << 32); to->e_lblk = ext2fs_le32_to_cpu(from->ee_block); to->e_len = ext2fs_le16_to_cpu(from->ee_len); - to->e_flags |= EXT2_EXTENT_FLAGS_LEAF; + to->e_flags = EXT2_EXTENT_FLAGS_LEAF; if (to->e_len > EXT_INIT_MAX_LEN) { to->e_len -= EXT_INIT_MAX_LEN; to->e_flags |= EXT2_EXTENT_FLAGS_UNINIT; |