提交 c4206d7c 编写于 作者: J Jiri Denemark

qemu: Avoid overflow when setting migration speed

When passing migration bandwidth to QEMU, we multiply it by 1024 * 1024
to convert the speed to B/s and the result still needs to fit in
int64_t.

https://bugzilla.redhat.com/show_bug.cgi?id=1083483Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 e0292e0c
...@@ -2047,6 +2047,13 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon, ...@@ -2047,6 +2047,13 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon,
return -1; return -1;
} }
if (bandwidth > QEMU_DOMAIN_MIG_BANDWIDTH_MAX) {
virReportError(VIR_ERR_OVERFLOW,
_("bandwidth must be less than %llu"),
QEMU_DOMAIN_MIG_BANDWIDTH_MAX + 1ULL);
return -1;
}
if (mon->json) if (mon->json)
ret = qemuMonitorJSONSetMigrationSpeed(mon, bandwidth); ret = qemuMonitorJSONSetMigrationSpeed(mon, bandwidth);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册