@@ -1311,7 +1311,6 @@ skip_blkcnt_fix:
nid, child.dot, child.dotdot);
if (c.fix_on) {
umode_t mode = le16_to_cpu(node_blk->i.i_mode);
- block_t blkaddr;
ret = convert_inline_dentry(sbi, node_blk,
&ni->blk_addr);
@@ -1326,7 +1325,7 @@ skip_blkcnt_fix:
ret = f2fs_add_link(sbi, node_blk,
(const unsigned char *)name,
1, nid, map_de_type(mode),
- &blkaddr, 0);
+ &ni->blk_addr, 0);
FIX_MSG("add missing '%s' dirent in ino: %u, pino: %u, ret:%d",
name, nid, child_d->p_ino, ret);
if (ret)
@@ -1340,7 +1339,7 @@ skip_blkcnt_fix:
(const unsigned char *)name,
2, child_d->p_ino,
map_de_type(mode),
- &blkaddr, 0);
+ &ni->blk_addr, 0);
FIX_MSG("add missing '%s' dirent in ino: %u, pino: %u, ret:%d",
name, nid, child_d->p_ino, ret);
if (ret)
If dot or dotdot is lost, fsck tries to add a new dentry by f2fs_add_link(). The blkaddr of the directory inode should be passed to it in order to update the dirty inode at the right place. This patch fixes the uninitialized `blkaddr' to avoid corrupting f2fs image. Signed-off-by: Sheng Yong <shengyong@oppo.com> --- fsck/fsck.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)