]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: check if block I/O limits fit into long long
authorJán Tomko <jtomko@redhat.com>
Mon, 24 Jun 2013 12:18:14 +0000 (14:18 +0200)
committerCole Robinson <crobinso@redhat.com>
Thu, 11 Jul 2013 21:48:44 +0000 (17:48 -0400)
We can only pass values up to LLONG_MAX through JSON
and QEMU checks if the int64_t number is not negative
at startup since 1.5.0.

https://bugzilla.redhat.com/show_bug.cgi?id=974010
(cherry picked from commit d3c87884927e6b745d0a5680e6d94a40c4f484f7)

src/qemu/qemu_driver.c

index 53ad478c8a12a54faf7fc5f7661328cc84a91a0d..3db344748283d15546b08c2b4ae28cb9c54d86e8 100644 (file)
@@ -13624,6 +13624,13 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];
 
+        if (param->value.ul > LLONG_MAX) {
+            virReportError(VIR_ERR_OVERFLOW,
+                           _("block I/O throttle limit value must"
+                             " be less than %llu"), LLONG_MAX);
+            goto endjob;
+        }
+
         if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC)) {
             info.total_bytes_sec = param->value.ul;
             set_bytes = true;