summaryrefslogtreecommitdiffstats
path: root/src/partition/repart.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/partition/repart.c')
-rw-r--r--src/partition/repart.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 368c2cd289..4857579977 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -796,7 +796,8 @@ static bool context_grow_partitions_phase(
* assigning this shouldn't impact the shares of the other
* partitions. */
- p->new_size = MAX(round_down_size(share, context->grain_size), rsz);
+ assert(share >= rsz);
+ p->new_size = CLAMP(round_down_size(share, context->grain_size), rsz, xsz);
charge = true;
}
@@ -822,7 +823,8 @@ static bool context_grow_partitions_phase(
p->new_padding = xsz;
charge = try_again = true;
} else if (phase == PHASE_DISTRIBUTE) {
- p->new_padding = MAX(round_down_size(share, context->grain_size), rsz);
+ assert(share >= rsz);
+ p->new_padding = CLAMP(round_down_size(share, context->grain_size), rsz, xsz);
charge = true;
}