[libvirt] [PATCH] qemu: avoid 32-bit compiler warning

Eric Blake eblake at redhat.com
Thu May 3 23:06:14 UTC 2012


On 32-bit platforms, gcc warns that the comparison between a long
and (ULLONG_MAX/1024/1024) is always false; throwing in a type
conversion shuts up the warning.

* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Shut gcc up.
---

Pushing under the build-breaker rule.

 src/qemu/qemu_monitor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ca1c7aa..0d4319d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2785,7 +2785,7 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon,
               modern);

     /* Convert bandwidth MiB to bytes */
-    if (bandwidth > ULLONG_MAX / 1024 / 1024) {
+    if (bandwidth * 1ULL > ULLONG_MAX / 1024 / 1024) {
         qemuReportError(VIR_ERR_OVERFLOW,
                         _("bandwidth must be less than %llu"),
                         ULLONG_MAX / 1024 / 1024);
-- 
1.7.7.6




More information about the libvir-list mailing list