From: Liu Zhangjian Date: Tue, 9 Jun 2026 13:15:52 +0000 (+0800) Subject: repart: fix SizeMinBytes/SizeMaxBytes rounding direction X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70d341b507b54ac205ea88f6ba0129fd30306e00;p=thirdparty%2Fsystemd.git repart: fix SizeMinBytes/SizeMaxBytes rounding direction The ltype parameter for SizeMinBytes and SizeMaxBytes in the config parsing table was reversed. SizeMinBytes should round UP (ltype > 0) to ensure the partition is at least the specified size, while SizeMaxBytes should round DOWN (ltype < 0) to ensure the partition doesn't exceed the specified size. This matches the documentation in repart.d.xml which correctly states: - SizeMinBytes: 'rounded upwards' - SizeMaxBytes: 'rounded downwards' The same fix is applied to PaddingMinBytes and PaddingMaxBytes which share the same config_parse_size4096 parser. Fixes: #42526 Co-developed-by: Claude Opus 4.6 Signed-off-by: Liu Zhangjian --- diff --git a/src/repart/repart.c b/src/repart/repart.c index f2020076749..1095a81dfb2 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -2929,10 +2929,10 @@ static int partition_read_definition( { "Partition", "Priority", config_parse_int32, 0, &p->priority }, { "Partition", "Weight", config_parse_weight, 0, &p->weight }, { "Partition", "PaddingWeight", config_parse_weight, 0, &p->padding_weight }, - { "Partition", "SizeMinBytes", config_parse_size4096, -1, &p->size_min }, - { "Partition", "SizeMaxBytes", config_parse_size4096, 1, &p->size_max }, - { "Partition", "PaddingMinBytes", config_parse_size4096, -1, &p->padding_min }, - { "Partition", "PaddingMaxBytes", config_parse_size4096, 1, &p->padding_max }, + { "Partition", "SizeMinBytes", config_parse_size4096, 1, &p->size_min }, + { "Partition", "SizeMaxBytes", config_parse_size4096, -1, &p->size_max }, + { "Partition", "PaddingMinBytes", config_parse_size4096, 1, &p->padding_min }, + { "Partition", "PaddingMaxBytes", config_parse_size4096, -1, &p->padding_max }, { "Partition", "FactoryReset", config_parse_bool, 0, &p->factory_reset }, { "Partition", "CopyBlocks", config_parse_copy_blocks, 0, p }, { "Partition", "Format", config_parse_fstype, 0, &p->format },