uint64_t d = 0;
if (p->encrypt != ENCRYPT_OFF)
- d += round_up_size(LUKS2_METADATA_KEEP_FREE, context->grain_size);
+ assert_se(INC_SAFE(&d, round_up_size(LUKS2_METADATA_KEEP_FREE, context->grain_size)));
if (p->copy_blocks_size != UINT64_MAX)
- d += round_up_size(p->copy_blocks_size, context->grain_size);
+ assert_se(INC_SAFE(&d, round_up_size(p->copy_blocks_size, context->grain_size)));
else if (p->format || p->encrypt != ENCRYPT_OFF) {
uint64_t f;
/* If we shall synthesize a file system, take minimal fs size into account (assumed to be 4K if not known) */
f = partition_fstype_min_size(context, p);
- d += f == UINT64_MAX ? context->grain_size : round_up_size(f, context->grain_size);
+ assert_se(INC_SAFE(&d, f == UINT64_MAX ? context->grain_size : round_up_size(f, context->grain_size)));
}
if (d > sz)