[PATCH] erofs-utils: fix chunk-based image handling without real data

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jan 31 20:48:08 AEDT 2023


Otherwise it will report:
 <I> erofs: total metadata: 982 blocks
 <E> erofs: 	Could not format the device : [Error 5] Input/output error

Fixes: 03cbf7b8f7f7 ("erofs-utils: mkfs: support chunk-based uncompressed files")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/blobchunk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index 744d054..55e3f85 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -276,6 +276,8 @@ int erofs_blob_remap(void)
 		erofs_bdrop(bh_devt, false);
 		return 0;
 	}
+	if (!length)	/* bail out if there is no chunked data */
+		return 0;
 	bh = erofs_balloc(DATA, length, 0, 0);
 	if (IS_ERR(bh))
 		return PTR_ERR(bh);
-- 
2.24.4



More information about the Linux-erofs mailing list