From: Peter Krempa Date: Mon, 5 Feb 2018 12:36:57 +0000 (+0100) Subject: util: bitmap: Fix value of 'map_alloc' when shrinking bitmap X-Git-Tag: v4.1.0-rc1~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf924e8e1be03982b0006e05b4faa3a645a45578;p=thirdparty%2Flibvirt.git util: bitmap: Fix value of 'map_alloc' when shrinking bitmap 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. --- 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; }