The virBitmap code uses VIR_RESIZE_N to do quadratic scaling, which
means that along with the number of requested map elements we also need
to keep the number of actually allocated elements for the scaling
algorithm to work properly.

The shrinking code did not fix 'map_alloc' thus virResizeN might
actually not expand the bitmap properly after called on a previously
shrunk bitmap.
---
 src/util/virbitmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0973731e3a..d1e5a9d1ea 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -1317,5 +1317,6 @@ virBitmapShrink(virBitmapPtr map,
         return -1;

     map->map_len = nl;
+    map->map_alloc = nl;
     return 0;
 }
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to