From: Yu Watanabe Date: Mon, 3 Jul 2023 06:14:14 +0000 (+0900) Subject: repart: fix free area calculation X-Git-Tag: v254-rc1~35^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2eb1f8145dee61c6bddfdcc5dac3591fa03f744;p=thirdparty%2Fsystemd.git repart: fix free area calculation Like fdisk_get_last_lba(), fdisk_partition_get_end() return the last sector in the partition. Fixes #28225. --- diff --git a/src/partition/repart.c b/src/partition/repart.c index a65a1aa962a..fc33a3eb625 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -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;