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:
Milan Broz
2017-07-24 14:15:42 +02:00
parent 96f1cdf687
commit 248e35036f

View File

@@ -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;