Do not create excessively large headers.

When creating LUKS2 header with specified --offset much larger
then LUKS2 header size we needlessly also wipe (allocate up to
--offset) much larger file than needed.
This commit is contained in:
Ondrej Kozina
2020-06-16 12:21:29 +02:00
committed by Milan Broz
parent ac535923e0
commit a15008d876
4 changed files with 10 additions and 4 deletions

View File

@@ -1874,7 +1874,7 @@ static int _crypt_format_luks2(struct crypt_device *cd,
goto out;
}
r = LUKS2_wipe_header_areas(cd, &cd->u.luks2.hdr);
r = LUKS2_wipe_header_areas(cd, &cd->u.luks2.hdr, cd->metadata_device != NULL);
if (r < 0) {
log_err(cd, _("Cannot wipe header on device %s."),
mdata_device_path(cd));