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

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



On 11/23/2012 05:00 PM, Daniel P. Berrange wrote:
On Fri, Nov 23, 2012 at 02:51:33PM +0800, Guannan Ren wrote:
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;
      }
Please add a test case to test/virbitmaptest.c which exposes the flaw
that this is fixing.

Regards,
Daniel

    okay, I will send v2 with testcase in it.


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