mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Add proper error message for invalid device_size reencryption argument.
This commit is contained in:
@@ -2429,6 +2429,14 @@ static int reencrypt_init(struct crypt_device *cd,
|
|||||||
|
|
||||||
data_size -= data_offset;
|
data_size -= data_offset;
|
||||||
|
|
||||||
|
if (params->device_size) {
|
||||||
|
if ((params->device_size << SECTOR_SHIFT) > data_size) {
|
||||||
|
log_err(cd, _("Reduced data size is larger than real device size."));
|
||||||
|
return -EINVAL;
|
||||||
|
} else
|
||||||
|
data_size = params->device_size << SECTOR_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
if (MISALIGNED(data_size, check_sector_size)) {
|
if (MISALIGNED(data_size, check_sector_size)) {
|
||||||
log_err(cd, _("Data device is not aligned to encryption sector size (%" PRIu32 " bytes)."), check_sector_size);
|
log_err(cd, _("Data device is not aligned to encryption sector size (%" PRIu32 " bytes)."), check_sector_size);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user