[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/2] 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
---
 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 4af2599..4605c78 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;
-- 
1.7.11.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]