]> www.infradead.org Git - users/hch/misc.git/commitdiff
erofs: fix block count report when 48-bit layout is on
authorGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 7 Aug 2025 08:20:19 +0000 (16:20 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Sun, 10 Aug 2025 22:31:19 +0000 (06:31 +0800)
Fix incorrect shift order when combining the 48-bit block count.

Fixes: 2e1473d5195f ("erofs: implement 48-bit block addressing for unencoded inodes")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250807082019.3093539-1-hsiangkao@linux.alibaba.com
fs/erofs/super.c

index 8c7a5985b4ee7f17c2d5aa2d823a7bf155e1d43d..1b529ace4db0ee82adc0c857ec87d667843da697 100644 (file)
@@ -323,8 +323,8 @@ static int erofs_read_superblock(struct super_block *sb)
        sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
        if (erofs_sb_has_48bit(sbi) && dsb->rootnid_8b) {
                sbi->root_nid = le64_to_cpu(dsb->rootnid_8b);
-               sbi->dif0.blocks = (sbi->dif0.blocks << 32) |
-                               le16_to_cpu(dsb->rb.blocks_hi);
+               sbi->dif0.blocks = sbi->dif0.blocks |
+                               ((u64)le16_to_cpu(dsb->rb.blocks_hi) << 32);
        } else {
                sbi->root_nid = le16_to_cpu(dsb->rb.rootnid_2b);
        }