Skip to content

Commit b797bd1

Browse files
yuwatabluca
authored andcommitted
repart: fix free area calculation
Like fdisk_get_last_lba(), fdisk_partition_get_end() return the last sector in the partition. Fixes #28225. (cherry picked from commit d2eb1f8) (cherry picked from commit 2299ca1)
1 parent 68fba1a commit b797bd1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/partition/repart.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,8 @@ static int determine_current_padding(
17511751
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Partition has no end!");
17521752

17531753
offset = fdisk_partition_get_end(p);
1754+
assert(offset < UINT64_MAX);
1755+
offset++; /* The end is one sector before the next partition or padding. */
17541756
assert(offset < UINT64_MAX / secsz);
17551757
offset *= secsz;
17561758

0 commit comments

Comments
 (0)