linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Huang Jianan via Linux-erofs <linux-erofs@lists.ozlabs.org>
To: linux-erofs@lists.ozlabs.org
Cc: yh@oppo.com, kevin.liw@oppo.com, guoweichao@oppo.com, guanyuwei@oppo.com
Subject: [PATCH V2] erofs-utils: fix random data for block-aligned uncompressed file
Date: Tue,  7 Sep 2021 11:53:45 +0800	[thread overview]
Message-ID: <20210907035345.22735-1-huangjianan@oppo.com> (raw)
In-Reply-To: <20210906081359.17440-2-huangjianan@oppo.com>

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.

This problem will cause inconsistent reproducible builds. Clear the
entire erofs_inode to zero to fix this.

Signed-off-by: Huang Jianan <huangjianan@oppo.com>
---
 lib/inode.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index 5bad75e..0cce07d 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -834,25 +834,15 @@ 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);
 
-	inode->i_parent = NULL;	/* also used to indicate a new inode */
-
 	inode->i_ino[0] = counter++;	/* inode serial number */
 	inode->i_count = 1;
 
 	init_list_head(&inode->i_subdirs);
 	init_list_head(&inode->i_xattrs);
-
-	inode->idata_size = 0;
-	inode->xattr_isize = 0;
-	inode->extent_isize = 0;
-
-	inode->bh = inode->bh_inline = inode->bh_data = NULL;
-	inode->idata = NULL;
-	inode->z_physical_clusterblks = 0;
 	return inode;
 }
 
-- 
2.25.1


  parent reply	other threads:[~2021-09-07  3:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06  8:13 [PATCH] erofs-utils: remove unnecessary "\n" Huang Jianan via Linux-erofs
2021-09-06  8:13 ` [PATCH] uerofs-utils: fix random data for block-aligned uncompressed file Huang Jianan via Linux-erofs
2021-09-07  0:10   ` Gao Xiang
2021-09-07  0:46     ` Gao Xiang
2021-09-07  2:54       ` Huang Jianan via Linux-erofs
2021-09-07  3:53   ` Huang Jianan via Linux-erofs [this message]
2021-09-07 13:20     ` [PATCH V2] erofs-utils: " Gao Xiang
2021-09-07 13:54       ` Huang Jianan via Linux-erofs
2021-09-07  0:08 ` [PATCH] erofs-utils: remove unnecessary "\n" Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210907035345.22735-1-huangjianan@oppo.com \
    --to=linux-erofs@lists.ozlabs.org \
    --cc=guanyuwei@oppo.com \
    --cc=guoweichao@oppo.com \
    --cc=huangjianan@oppo.com \
    --cc=kevin.liw@oppo.com \
    --cc=yh@oppo.com \
    --subject='Re: [PATCH V2] erofs-utils: fix random data for block-aligned uncompressed file' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).