From: Jiri Denemark Date: Fri, 11 Apr 2014 09:24:51 +0000 (+0200) Subject: qemu: Avoid overflow when setting migration speed X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c4206d7c7e2c82bcdabd8a7548e14c48cdab4e14;p=libvirt.git 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=1083483 Signed-off-by: Jiri Denemark --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5a5a59ba1e..912bea1824 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2047,6 +2047,13 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon, 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) ret = qemuMonitorJSONSetMigrationSpeed(mon, bandwidth); else