From d45cf9847eacb29f820d8854e95d23440f3bd3e0 Mon Sep 17 00:00:00 2001 From: Guannan Ren Date: Tue, 5 Mar 2013 23:13:21 +0800 Subject: [PATCH] util: fix a integer boundary error A value which is equal to a integer maximum such as LLONG_MAX is a valid integer value. The patch fix the following error: 1, virsh memtune vm --swap-hard-limit -1 2, virsh start vm In debug mode, it shows error like: virScaleInteger:1813 : numerical overflow:\ value too large: 9007199254740991KiB (cherry picked from commit b38a040a2996ea5e0ff4ef41e69114e3681592ba) --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 4af2599c55..4605c78ca7 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1809,7 +1809,7 @@ virScaleInteger(unsigned long long *value, const char *suffix, } } - if (*value && *value >= (limit / scale)) { + if (*value && *value > (limit / scale)) { virReportError(VIR_ERR_OVERFLOW, _("value too large: %llu%s"), *value, suffix); return -1;