From f1fd38c7264459efcda746f09892316b6528c781 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Sun, 22 May 2022 17:06:59 +0200 Subject: [PATCH] bitlk: Add warning when activating device with wrong size --- lib/bitlk/bitlk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c index d47c1a24..441b8ce3 100644 --- a/lib/bitlk/bitlk.c +++ b/lib/bitlk/bitlk.c @@ -1212,6 +1212,11 @@ static int _activate(struct crypt_device *cd, if (r) return r; + if (dmd.size * SECTOR_SIZE != params->volume_size) + log_std(cd, _("WARNING: BitLocker volume size %" PRIu64 " does not match the underlying device size %" PRIu64 ""), + params->volume_size, + dmd.size * SECTOR_SIZE); + /* there will be always 4 dm-zero segments: 3x metadata, 1x FS header */ for (i = 0; i < 3; i++) { segments[num_segments].offset = params->metadata_offset[i] / SECTOR_SIZE;