Unify checks for misaligned values.

This commit is contained in:
Ondrej Kozina
2018-08-24 11:27:40 +02:00
committed by Milan Broz
parent 622943529e
commit d41b1a7560
7 changed files with 25 additions and 17 deletions

View File

@@ -153,7 +153,7 @@ int crypt_wipe_device(struct crypt_device *cd,
/* 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))
if (MISALIGNED_512(offset) || MISALIGNED_512(length) || MISALIGNED_512(wipe_block_size))
return -EINVAL;
devfd = device_open(device, O_RDWR);