]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: avoid older gcc warning
authorEric Blake <eblake@redhat.com>
Wed, 26 Sep 2012 17:16:36 +0000 (11:16 -0600)
committerCole Robinson <crobinso@redhat.com>
Wed, 17 Oct 2012 20:42:13 +0000 (16:42 -0400)
Jim Fehlig reported a compilation error with older gcc 4.3.4:

libvirt.c: In function 'virDomainGetEmulatorPinInfo':
libvirt.c:9111: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]

It looks like someone programmed via too much copy-and-paste.

* src/libvirt.c (virDomainGetEmulatorPinInfo): Multiplying by 1 is
a no-op, and thus will never overflow.
(cherry picked from commit 3da355e8c418c6db4023cc35512c7f47a78851ce)

src/libvirt.c

index 0cbcfbf288d808d7b620b8dca2d3ae344b3b4a68..dfda67f88aadafe83758594a3ff408e2b78fd292 100644 (file)
@@ -9102,11 +9102,6 @@ virDomainGetEmulatorPinInfo(virDomainPtr domain, unsigned char *cpumap,
         virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         goto error;
     }
-    if (INT_MULTIPLY_OVERFLOW(1, maplen)) {
-        virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: 1 * %d"),
-                          maplen);
-        goto error;
-    }
 
     /* At most one of these two flags should be set.  */
     if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&