aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2015-10-19 17:53:29 +0200
committerKevin Wolf <kwolf@redhat.com>2015-10-23 18:18:23 +0200
commit5433c24f0f9306c82ad9bcc2b2b586e5f0ed8fa5 (patch)
tree8b2eb29767ef12bf28d528050a0463b3e9458f5b /migration
parent0c3c36d651922ebe9244e68e6d9ed14cdfcac9fd (diff)
block: Prepare for NULL BDS
blk_bs() will not necessarily return a non-NULL value any more (unless blk_is_available() is true or it can be assumed to otherwise, e.g. because it is called immediately after a successful blk_new_with_bs() or blk_new_open()). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/block.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/migration/block.c b/migration/block.c
index ed865ed23b..f7bb1e0126 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -808,6 +808,11 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
return -EINVAL;
}
bs = blk_bs(blk);
+ if (!bs) {
+ fprintf(stderr, "Block device %s has no medium\n",
+ device_name);
+ return -EINVAL;
+ }
if (bs != bs_prev) {
bs_prev = bs;