Re: [PATCH] blkid: allow up to 64k erofs block sizes

Gao Xiang <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <Z5LPPNtOD3DqplCt@debian>
Hi Eric,

On Thu, Jan 23, 2025 at 01:17:10PM -0600, Eric Sandeen wrote:
> Today, mkfs.erofs defaults to page size for block size, but blkid
> does not recognize this. Increase the limit to 64k.
> 
> Signed-off-by: Eric Sandeen <[email protected]>
> ---
> 
> (There might be strange arches out there > 64k but I don't know if
> erofs really works with blocks that big, so for now let's just
> limit it to 64k?)
> 
> diff --git a/libblkid/src/superblocks/erofs.c b/libblkid/src/superblocks/erofs.c
> index 05822460b..89620db47 100644
> --- a/libblkid/src/superblocks/erofs.c
> +++ b/libblkid/src/superblocks/erofs.c
> @@ -73,8 +73,8 @@ static int probe_erofs(blkid_probe pr, const struct blkid_idmag *mag)
>  	if (!sb)
>  		return errno ? -errno : BLKID_PROBE_NONE;
>  
> -	/* EROFS is restricted to 4KiB block size */
> -	if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 4096)
> +	/* block size must be between 512 and 64k */
> +	if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 65536)

I think it should be

	if (sb->blkszbits < 9 || ..

?

Also (1U << sb->blkszbits) might be overflowed, so just use
sb->blkszbits > 16.

Otherwise it looks good to me.

Thanks,
Gao Xiang

>  		return BLKID_PROBE_NONE;
>  
>  	if (!erofs_verify_checksum(pr, mag, sb))
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.