summaryrefslogtreecommitdiffstats
path: root/src/sysupdate
diff options
context:
space:
mode:
authorMichael A Cassaniti <michael@cassaniti.id.au>2023-08-11 14:05:45 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-08-15 09:17:12 +0200
commiteeee4861594f2827fb80d748535489f46ec036a4 (patch)
tree5aaff340cabe37caa0a20c0fbdfb871c99c9faa9 /src/sysupdate
parentMerge pull request #28829 from DaanDeMeyer/mount-fd (diff)
downloadsystemd-eeee4861594f2827fb80d748535489f46ec036a4.tar.xz
systemd-eeee4861594f2827fb80d748535489f46ec036a4.zip
sysupdate: Use sector size for partition size calculations
Diffstat (limited to 'src/sysupdate')
-rw-r--r--src/sysupdate/sysupdate-partition.c10
1 files changed, 6 insertions, 4 deletions
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)