[PATCH] fix uint64 underflow

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

 



According to previous statement,
'free_mem' is less than 'needed_mem'.
So, the subtraction 'free_mem - needed_mem' is negative,
and will raise uint64 underflow.

Signed-off-by: Dmitry Frolov <frolov@xxxxxxxxx>
---
 src/libxl/libxl_domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 6c167df63e..36be042971 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -940,7 +940,7 @@ libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config)
         if (free_mem >= needed_mem)
             return 0;
 
-        target_mem = free_mem - needed_mem;
+        target_mem = needed_mem - free_mem;
         if (libxlSetMemoryTargetWrapper(ctx, 0, target_mem,
                                         /* relative */ 1, 0) < 0)
             goto error;
-- 
2.34.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux