[PATCH] erofs-utils: check the return value of ftell

Gao Xiang hsiangkao at linux.alibaba.com
Fri Feb 18 18:03:11 AEDT 2022


On Fri, Feb 18, 2022 at 11:11:35AM +0800, Huang Jianan via Linux-erofs wrote:
> Need to check if we got a normal length.
> 
> Signed-off-by: Huang Jianan <huangjianan at oppo.com>

Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>  lib/blobchunk.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/blobchunk.c b/lib/blobchunk.c
> index 4a440d6..483362b 100644
> --- a/lib/blobchunk.c
> +++ b/lib/blobchunk.c
> @@ -221,6 +221,8 @@ int erofs_blob_remap(void)
>  
>  	fflush(blobfile);
>  	length = ftell(blobfile);
> +	if (length < 0)
> +		return -errno;
>  	if (multidev) {
>  		struct erofs_deviceslot dis = {
>  			.blocks = erofs_blknr(length),
> -- 
> 2.25.1


More information about the Linux-erofs mailing list