parallels: skip loading a genuinely empty bitmap L1 table
parallels_load_bitmap_data() unconditionally calls bdrv_dirty_bitmap_deserialize_finish() even when there is nothing to deserialize, which hits an assertion in hbitmap (hbitmap_iter_init: 'pos < hb->size') when the bitmap itself has zero size, i.e. the disk is a zero-sector image. Skip allocating, populating and loading the L1 table entirely when l1_size == 0. This is safe only because the previous commit already guarantees l1_size == 0 exclusively means the disk has 0 size. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Thomas Huth <thuth@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com>
Denis V. Lunev committed
Jul 22, 2026 at 18:54 UTC
d5250d7ed772d704d7143c94227979c5518a2f40
1 file changed
+10
-7
block/parallels-ext.c
+10
-7
@@ -168,14 +168,17 @@ parallels_load_bitmap(BlockDriverState *bs, uint8_t *data, size_t data_size,
168
goto fail;
169
}
170
171
- l1_table = g_new(uint64_t, bf.l1_size);
172
- for (i = 0; i < bf.l1_size; i++, data += sizeof(uint64_t)) {
173
- l1_table[i] = ldq_le_p(data);
174
- }
171
+ if (bf.l1_size != 0) {
172
+ l1_table = g_new(uint64_t, bf.l1_size);
173
+ for (i = 0; i < bf.l1_size; i++, data += sizeof(uint64_t)) {
174
+ l1_table[i] = ldq_le_p(data);
175
+ }
176
176
- ret = parallels_load_bitmap_data(bs, l1_table, bf.l1_size, bitmap, errp);
177
- if (ret < 0) {
178
- goto fail;
177
+ ret = parallels_load_bitmap_data(bs, l1_table, bf.l1_size, bitmap,
178
+ errp);
179
+ if (ret < 0) {
180
+ goto fail;
181
+ }
182
}
183
184
/* We support format extension only for RO parallels images. */