From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>,
peter.maydell@linaro.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Fam Zheng <famz@redhat.com>, John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH] migration: Appease coverity, skip empty block trees
Date: Fri, 22 Jun 2018 16:11:22 -0400 [thread overview]
Message-ID: <20180622201122.9358-1-jsnow@redhat.com> (raw)
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
next reply other threads:[~2018-06-22 20:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 20:11 John Snow [this message]
2018-06-22 20:24 ` [Qemu-devel] [PATCH] migration: Appease coverity, skip empty block trees 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180622201122.9358-1-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=dgilbert@redhat.com \
--cc=famz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).