Skip to contentSkip to conversation

mdadm/super1: It needs to specify int32 for bitmap_offset

PATCH Applied Xiao Ni 2 participants 3 messages Jun 2, 2021 – Jul 16, 2021 MD RAID

lore
Share & tools
lore

Xiao Ni

author
#0 lore raw

PATCH 1/1 mdadm/super1: It needs to specify int32 for bitmap_offset

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)
---
 super1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
super1.c +1 -1
index c05e623..a12a5bc 100644
@@ -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;
Signature · 1 line
2.7.5
author
#1 lore raw

Hi Jes

Ping, is the patch ok for you to merge it

Regards
Xiao

Quoted 25 lines · Xiao Ni

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)
---
 super1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
super1.c +1 -2
index c05e623..a12a5bc 100644
@@ -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;
--

2.7.5

Applied
#2 lore raw
In reply to Xiao Ni
Quoted 7 lines · Xiao Ni

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)
---
 super1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks!

Jes