1 Star 0 Fork 17

sys0613/e2fsprogs

forked from src-anolis-os/e2fsprogs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1004-e2fsck-initialize-variable-before-first-use-in-fast-.patch 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
josephhz 提交于 2022-08-15 11:03 . support ext4 fast commit
From 780f047c749a582806326d75180fe68d84e220c2 Mon Sep 17 00:00:00 2001
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Date: Tue, 23 Feb 2021 09:41:56 -0800
Subject: [PATCH 4/9] 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>
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
e2fsck/journal.c | 2 +-
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 bde6b0f3..542e5034 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;
--
2.24.4
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sys0613/e2fsprogs.git
git@gitee.com:sys0613/e2fsprogs.git
sys0613
e2fsprogs
e2fsprogs
a8

搜索帮助