Avoid possible divide-by-zero warnings.

This commit is contained in:
Milan Broz
2016-04-24 12:38:19 +02:00
parent 1f51cfcf57
commit 7eba57b4c0
2 changed files with 4 additions and 1 deletions

View File

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