mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Do not fail if wipe size is smaller than block size.
With big page size and image in file this can actually happen. The command works in this situation but the code will be quite ineffective (due to blockwise handling).
This commit is contained in:
@@ -147,9 +147,11 @@ int crypt_wipe_device(struct crypt_device *cd,
|
||||
/* Note: LUKS1 calls it with wipe_block not aligned to multiple of bsize */
|
||||
bsize = device_block_size(device);
|
||||
alignment = device_alignment(device);
|
||||
if (!bsize || !alignment || (wipe_block_size < bsize))
|
||||
if (!bsize || !alignment || !wipe_block_size)
|
||||
return -EINVAL;
|
||||
|
||||
/* FIXME: if wipe_block_size < bsize, then a wipe is highly ineffective */
|
||||
|
||||
/* Everything must be aligned to SECTOR_SIZE */
|
||||
if ((offset % SECTOR_SIZE) || (length % SECTOR_SIZE) || (wipe_block_size % SECTOR_SIZE))
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user