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

Gao Xiang xiang at kernel.org
Tue Sep 7 23:20:50 AEST 2021


On Tue, Sep 07, 2021 at 11:53:45AM +0800, Huang Jianan via Linux-erofs wrote:
> 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 at oppo.com>

Reviewed-by: Gao Xiang <xiang at kernel.org>

BTW, how about adding --from="Huang Jianan <huangjianan at oppo.com>" when
sending patches with OPPO emails.

Otherwise, it seems the author becomes
"Huang Jianan via Linux-erofs <linux-erofs at lists.ozlabs.org>" when
reaching to the mailing list and I have to update it by hand....

Thanks,
Gao Xiang

> ---
>  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
> 


More information about the Linux-erofs mailing list