From: Eric Blake Date: Mon, 8 Sep 2014 14:50:48 +0000 (-0600) Subject: blockjob: avoid 32-bit compilation warning X-Git-Tag: CVE-2014-3633~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe5061f5a61d04b1bf21fcac2919a2325f54150;p=thirdparty%2Flibvirt.git blockjob: avoid 32-bit compilation warning Commit c1d75de caused this warning on 32-bit platforms (fatal when -Werror is enabled): virsh-domain.c: In function 'cmdBlockCopy': virsh-domain.c:2003:17: error: comparison is always false due to limited range of data type [-Werror=type-limits] Forcing the left side of the < to be ull instead of ul shuts up the 32-bit compiler while still protecting 64-bit code from overflow. * tools/virsh-domain.c (cmdBlockCopy): Add type coercion. Signed-off-by: Eric Blake --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 39ff798ab3..ed2e3eab5f 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2000,7 +2000,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) if (bandwidth) { /* bandwidth is ulong MiB/s, but the typed parameter is * ullong bytes/s; make sure we don't overflow */ - if (bandwidth > ULLONG_MAX >> 20) { + if (bandwidth + 0ULL > ULLONG_MAX >> 20) { virReportError(VIR_ERR_OVERFLOW, _("bandwidth must be less than %llu"), ULLONG_MAX >> 20);