
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 -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|