Skip to content

Commit 79f5c72

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) (cherry picked from commit b797bd1)
1 parent a259797 commit 79f5c72

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
@@ -1447,6 +1447,8 @@ static int determine_current_padding(
14471447
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Partition has no end!");
14481448

14491449
offset = fdisk_partition_get_end(p);
1450+
assert(offset < UINT64_MAX);
1451+
offset++; /* The end is one sector before the next partition or padding. */
14501452
assert(offset < UINT64_MAX / secsz);
14511453
offset *= secsz;
14521454

0 commit comments

Comments
 (0)