mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 10:50:01 +01:00
Avoid possible divide-by-zero warnings.
This commit is contained in:
@@ -723,6 +723,9 @@ int TCRYPT_activate(struct crypt_device *cd,
|
||||
if (!algs)
|
||||
return -EINVAL;
|
||||
|
||||
if (hdr->d.sector_size == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (params->flags & CRYPT_TCRYPT_SYSTEM_HEADER)
|
||||
dmd.size = 0;
|
||||
else if (params->flags & CRYPT_TCRYPT_HIDDEN_HEADER)
|
||||
|
||||
@@ -317,7 +317,7 @@ int tools_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size)
|
||||
}
|
||||
|
||||
tmp = *size * mult;
|
||||
if ((tmp / *size) != mult) {
|
||||
if (*size && (tmp / *size) != mult) {
|
||||
log_dbg("Device size overflow.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user