[PATCH v3 01/11] erofs-utils: lib: fix erofs_init_devices

Jingbo Xu jefflexu at linux.alibaba.com
Tue Aug 22 19:24:47 AEST 2023


Fix the missing le32_to_cpu() when parsing the device slot.  Read and
cache the number of blocks of each device for later use.

Fixes: 0ce853a01123 ("erofs-utils: fuse: add multiple device support")
[1] https://github.com/erofs/erofsnightly/actions/runs/5921003885/job/16053013007
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
 lib/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/super.c b/lib/super.c
index 21dc51f..4fe81c3 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -60,8 +60,9 @@ static int erofs_init_devices(struct erofs_sb_info *sbi,
 			return ret;
 		}
 
-		sbi->devs[i].mapped_blkaddr = dis.mapped_blkaddr;
-		sbi->total_blocks += dis.blocks;
+		sbi->devs[i].mapped_blkaddr = le32_to_cpu(dis.mapped_blkaddr);
+		sbi->devs[i].blocks = le32_to_cpu(dis.blocks);
+		sbi->total_blocks += sbi->devs[i].blocks;
 		pos += EROFS_DEVT_SLOT_SIZE;
 	}
 	return 0;
-- 
2.19.1.6.gb485710b



More information about the Linux-erofs mailing list