[PATCH] uerofs-utils: fix random data for block-aligned uncompressed file

Huang Jianan huangjianan at oppo.com
Mon Sep 6 18:13:59 AEST 2021


If the file size is block-aligned for uncompressed files, i_u is
meaningless for erofs_inode on disk, but it's not cleared when
datalayout is seted in erofs_prepare_inode_buffer. Clear the entire
erofs_inode to zero to fix this.

Signed-off-by: Huang Jianan <huangjianan at oppo.com>
---
 lib/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index 0ad703d..1397cc5 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -834,7 +834,7 @@ static struct erofs_inode *erofs_new_inode(void)
 	static unsigned int counter;
 	struct erofs_inode *inode;
 
-	inode = malloc(sizeof(struct erofs_inode));
+	inode = calloc(1, sizeof(struct erofs_inode));
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.25.1



More information about the Linux-erofs mailing list