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

[libvirt] [PATCH] bitmap: fix typo to use UL type of integer constant in virBitmapIsAllSet



This bug leads to get incorrect vcpupin information via
qemudDomainGetVcpuPinInfo() API when the number of maximum
cpu on a host falls into a scope such as 31 < ncpus < 64.

gcc warning:
left shift count >= width of type

The following bug is such a case
https://bugzilla.redhat.com/show_bug.cgi?id=876415
---
 src/util/bitmap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/bitmap.c b/src/util/bitmap.c
index 5ec5440..c29f5f3 100644
--- a/src/util/bitmap.c
+++ b/src/util/bitmap.c
@@ -574,8 +574,8 @@ bool virBitmapIsAllSet(virBitmapPtr bitmap)
             return false;
 
     if (unusedBits > 0) {
-        if ((bitmap->map[sz] & ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
-            != ((1U << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+        if ((bitmap->map[sz] & ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
+            != ((1UL << (VIR_BITMAP_BITS_PER_UNIT - unusedBits)) - 1))
             return false;
     }
 
-- 
1.7.1


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