repart: add assert for offset + current_size overflow safety

Coverity flags a->after->offset + a->after->current_size as a
potential overflow. Both values are validated as not UINT64_MAX
by existing asserts, add an explicit overflow check to document
the invariant for static analyzers.

CID#1548063

Follow-up for e594a3b154
This commit is contained in:
Luca Boccassi
2026-03-30 09:37:31 +01:00
parent 3fd6774633
commit 96b085c4be
+2
View File
@@ -1247,6 +1247,8 @@ static uint64_t free_area_current_end(Context *context, const FreeArea *a) {
assert(a->after->offset != UINT64_MAX);
assert(a->after->current_size != UINT64_MAX);
/* Silence static analyzers */
assert(a->after->current_size <= UINT64_MAX - a->after->offset);
/* Calculate where the free area ends, based on the offset of the partition preceding it. */
return round_up_size(a->after->offset + a->after->current_size, context->grain_size) + free_area_available(a);