]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: bitmap: Note that shrinking the bitmap requires clearing of unused bits
authorPeter Krempa <pkrempa@redhat.com>
Mon, 5 Feb 2018 13:05:05 +0000 (14:05 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 5 Feb 2018 15:08:57 +0000 (16:08 +0100)
Note the fact that the unused portion of the last element in the bitmap
needs to be cleared, since we use functions which process only full-size
elements and don't really deal with individual bits.

src/util/virbitmap.c

index 82b1f76427b6d2a62288fbb601af8e332f0b4a4b..0cc5292d8c4e19dc45d95b69e56f704b0e6abccc 100644 (file)
@@ -45,6 +45,10 @@ struct _virBitmap {
     size_t nbits;
     size_t map_len;
     size_t map_alloc;
+
+    /* Note that code below depends on the fact that unused bits of the bitmap
+     * are not set. Any function decreasing the size of the map needs clear
+     * bits which don't belong to the bitmap any more. */
     unsigned long *map;
 };