]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/super1: It needs to specify int32 for bitmap_offset
authorXiao Ni <xni@redhat.com>
Wed, 2 Jun 2021 01:17:19 +0000 (09:17 +0800)
committerJes Sorensen <jsorensen@fb.com>
Fri, 16 Jul 2021 14:21:49 +0000 (10:21 -0400)
For super1.0 bitmap offset is -16. So it needs to use int type for bitmap offset.

Fixes: 1fe2e1007310 (mdadm/bitmap: locate bitmap calcuate bitmap position wrongly)
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super1.c

index c05e6237db5c2f4d15508650469456e18758d80a..a12a5bc847b904f581ffe1588022fb708c4927a7 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -2631,7 +2631,7 @@ static int locate_bitmap1(struct supertype *st, int fd, int node_num)
        else
                ret = -1;
 
-       offset = __le64_to_cpu(sb->super_offset) + __le32_to_cpu(sb->bitmap_offset);
+       offset = __le64_to_cpu(sb->super_offset) + (int32_t)__le32_to_cpu(sb->bitmap_offset);
        if (node_num) {
                bms = (bitmap_super_t*)(((char*)sb)+MAX_SB_SIZE);
                bm_sectors_per_node = calc_bitmap_size(bms, 4096) >> 9;