From eeee4861594f2827fb80d748535489f46ec036a4 Mon Sep 17 00:00:00 2001 From: Michael A Cassaniti Date: Fri, 11 Aug 2023 22:05:45 +1000 Subject: sysupdate: Use sector size for partition size calculations --- src/sysupdate/sysupdate-partition.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/sysupdate') diff --git a/src/sysupdate/sysupdate-partition.c b/src/sysupdate/sysupdate-partition.c index fa4453d665..6f8e072277 100644 --- a/src/sysupdate/sysupdate-partition.c +++ b/src/sysupdate/sysupdate-partition.c @@ -28,6 +28,7 @@ int read_partition_info( const char *label; struct fdisk_partition *p; uint64_t start, size, flags; + unsigned long ssz; sd_id128_t ptid, id; GptPartitionType type; size_t partno; @@ -54,12 +55,13 @@ int read_partition_info( partno = fdisk_partition_get_partno(p); start = fdisk_partition_get_start(p); - assert(start <= UINT64_MAX / 512U); - start *= 512U; + ssz = fdisk_get_sector_size(c); + assert(start <= UINT64_MAX / ssz); + start *= ssz; size = fdisk_partition_get_size(p); - assert(size <= UINT64_MAX / 512U); - size *= 512U; + assert(size <= UINT64_MAX / ssz); + size *= ssz; label = fdisk_partition_get_name(p); if (!label) -- cgit v1.2.3