We need an accurate count of the number of bits set in a bitmap after a merge. In particular, since the merge operation short-circuits a merge from an empty source, if you have bitmaps A, B, and C where B started empty, then merge C into B, and B into A, an inaccurate count meant that A did not get the contents of C.
Fixes: be58721db CC: qemu-sta...@nongnu.org Signed-off-by: Eric Blake <ebl...@redhat.com> --- Probably worth some testsuite coverage, but for a late-night one-liner, this is as much as I can do today. util/hbitmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/hbitmap.c b/util/hbitmap.c index bcd304041aa..52e12da4b48 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -753,3 +753,4 @@ bool hbitmap_merge(HBitmap *a, const HBitmap *b) a->levels[i][j] |= b->levels[i][j]; } } + a->count = hb_count_between(a, 0, a->size - 1); return true; } -- 2.17.1