All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm zoned: Avoid 64-bit division error in dmz_fixup_devices
@ 2020-05-13  8:45 Nathan Chancellor
  2020-05-14  6:25 ` [dm-devel] " Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2020-05-13  8:45 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer
  Cc: dm-devel, Hannes Reinecke, linux-kernel, Nathan Chancellor

When building arm32 allyesconfig:

ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> 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")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/md/dm-zoned-target.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index ea43f6892ced..9c4fd4b04878 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dm-devel] [PATCH] dm zoned: Avoid 64-bit division error in dmz_fixup_devices
  2020-05-13  8:45 [PATCH] dm zoned: Avoid 64-bit division error in dmz_fixup_devices Nathan Chancellor
@ 2020-05-14  6:25 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2020-05-14  6:25 UTC (permalink / raw)
  To: Nathan Chancellor, Alasdair Kergon, Mike Snitzer; +Cc: dm-devel, linux-kernel

On 2020/05/14 14:07, Nathan Chancellor wrote:
> When building arm32 allyesconfig:
> 
> ld.lld: error: undefined symbol: __aeabi_uldivmod
>>>> 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")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/md/dm-zoned-target.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
> index ea43f6892ced..9c4fd4b04878 100644
> --- a/drivers/md/dm-zoned-target.c
> +++ b/drivers/md/dm-zoned-target.c
> @@ -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
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-14  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13  8:45 [PATCH] dm zoned: Avoid 64-bit division error in dmz_fixup_devices Nathan Chancellor
2020-05-14  6:25 ` [dm-devel] " Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.