repart: fix free area calculation

Like fdisk_get_last_lba(), fdisk_partition_get_end() return the last
sector in the partition.

Fixes #28225.
This commit is contained in:
Yu Watanabe 2023-07-03 15:14:14 +09:00
parent beba8f2e1e
commit d2eb1f8145

View file

@ -1922,6 +1922,8 @@ static int determine_current_padding(
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Partition has no end!");
offset = fdisk_partition_get_end(p);
assert(offset < UINT64_MAX);
offset++; /* The end is one sector before the next partition or padding. */
assert(offset < UINT64_MAX / secsz);
offset *= secsz;