Skip to contentSkip to conversation

dm zoned: Avoid 64-bit division error in dmz_fixup_devices

PATCH In review Nathan Chancellor 2 participants 2 messages May 13, 2020 – May 14, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm zoned: Avoid 64-bit division error in dmz_fixup_devices

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by dm-zoned-target.c
md/dm-zoned-target.o:(dmz_ctr) in archive drivers/built-in.a

dmz_fixup_devices uses DIV_ROUND_UP with variables of type sector_t. As such, it should be using DIV_ROUND_UP_SECTOR_T, which handles this automatically.

Fixes 70978208ec91 ("dm zoned: metadata version 2")
---
 drivers/md/dm-zoned-target.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-zoned-target.c +3 -2
index ea43f6892ced..9c4fd4b04878 100644
@@ -803,8 +803,9 @@ static int dmz_fixup_devices(struct dm_target *ti)
 
 	if (reg_dev) {
 		reg_dev->zone_nr_sectors = zoned_dev->zone_nr_sectors;
-		reg_dev->nr_zones = DIV_ROUND_UP(reg_dev->capacity,
-						 reg_dev->zone_nr_sectors);
+		reg_dev->nr_zones =
+			DIV_ROUND_UP_SECTOR_T(reg_dev->capacity,
+					      reg_dev->zone_nr_sectors);
 		zoned_dev->zone_offset = reg_dev->nr_zones;
 	}
 	return 0;

base-commit: e098d7762d602be640c53565ceca342f81e55ad2

Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Nathan Chancellor

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

referenced by dm-zoned-target.c
md/dm-zoned-target.o:(dmz_ctr) in archive drivers/built-in.a

dmz_fixup_devices uses DIV_ROUND_UP with variables of type sector_t. As such, it should be using DIV_ROUND_UP_SECTOR_T, which handles this automatically.

Fixes 70978208ec91 ("dm zoned: metadata version 2")
---
 drivers/md/dm-zoned-target.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-zoned-target.c +3 -2
index ea43f6892ced..9c4fd4b04878 100644
@@ -803,8 +803,9 @@ static int dmz_fixup_devices(struct dm_target *ti)
 
 	if (reg_dev) {
 		reg_dev->zone_nr_sectors = zoned_dev->zone_nr_sectors;
-		reg_dev->nr_zones = DIV_ROUND_UP(reg_dev->capacity,
-						 reg_dev->zone_nr_sectors);
+		reg_dev->nr_zones =
+			DIV_ROUND_UP_SECTOR_T(reg_dev->capacity,
+					      reg_dev->zone_nr_sectors);>  		zoned_dev->zone_offset = reg_dev->nr_zones;
 	}
 	return 0;
 
Quoted 2 lines

base-commit: e098d7762d602be640c53565ceca342f81e55ad2

Looks good.

Signature · 2 lines
Damien Le Moal
Western Digital Research