In fsck_chk_inode_blk, we will allocate 256 bytes memory in stack before
traversing sub-directory recursively, it's not safe, in order to avoid
potential stack overflow, use malloc instead.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
u64 i_size = le64_to_cpu(node_blk->i.i_size);
u64 i_blocks = le64_to_cpu(node_blk->i.i_blocks);
int ofs = get_extra_isize(node_blk);
- unsigned char en[F2FS_NAME_LEN + 1];
+ unsigned char *en;
int namelen;
unsigned int idx = 0;
int need_fix = 0;
}
}
skip_blkcnt_fix:
+ en = malloc(F2FS_NAME_LEN + 1);
+ ASSERT(en);
+
namelen = convert_encrypted_name(node_blk->i.i_name,
le32_to_cpu(node_blk->i.i_namelen),
en, file_enc_name(&node_blk->i));
}
}
}
+
+ free(en);
+
if (ftype == F2FS_FT_SYMLINK && i_blocks && i_size == 0) {
DBG(1, "ino: 0x%x i_blocks: %lu with zero i_size",
nid, (unsigned long)i_blocks);