qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: Appease coverity, skip empty block trees
@ 2018-06-22 20:11 John Snow
  2018-06-22 20:24 ` Philippe Mathieu-Daudé
  2018-06-29 17:07 ` Stefan Hajnoczi
  0 siblings, 2 replies; 6+ messages in thread
From: John Snow @ 2018-06-22 20:11 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: Juan Quintela, peter.maydell, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Fam Zheng, John Snow

If a tree consists exclusively of implicit filter nodes, we might crash
QEMU. This configuration should not exist in practice, but if it did,
skipping it would be fine.

For the purposes of debug builds, throw an assert to remind us that
this configuration is truly unexpected, but if it's compiled out we
will cope just fine.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 migration/block-dirty-bitmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 3bafbbdc4c..02725293dd 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -287,6 +287,10 @@ static int init_dirty_bitmap_migration(void)
         while (bs && bs->drv && bs->implicit) {
             bs = backing_bs(bs);
         }
+        if (!bs) {
+            g_assert_not_reached();
+            continue;
+        }
 
         for (bitmap = bdrv_dirty_bitmap_next(bs, NULL); bitmap;
              bitmap = bdrv_dirty_bitmap_next(bs, bitmap))
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-29 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-22 20:11 [Qemu-devel] [PATCH] migration: Appease coverity, skip empty block trees John Snow
2018-06-22 20:24 ` Philippe Mathieu-Daudé
2018-06-22 20:35   ` John Snow
2018-06-22 20:58     ` Philippe Mathieu-Daudé
2018-06-29 17:07 ` Stefan Hajnoczi
2018-06-29 21:36   ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).