diff options
author | Orit Wassermann <owasserm@redhat.com> | 2012-05-16 12:21:35 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-21 15:40:50 -0500 |
commit | 2a633c461e96cb9a856292c46917653bd43959c8 (patch) | |
tree | 2907c129ba38047391cea14d072594f866479450 /hw/virtio-blk.c | |
parent | a6c5c84ae25bc68f22725f77d6d77c98af5c4f9e (diff) |
virtio: check virtio_load return code
Otherwise we crash on error.
Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r-- | hw/virtio-blk.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 9f605d37cb..f9e1896ea9 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -533,11 +533,16 @@ static void virtio_blk_save(QEMUFile *f, void *opaque) static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id) { VirtIOBlock *s = opaque; + int ret; if (version_id != 2) return -EINVAL; - virtio_load(&s->vdev, f); + ret = virtio_load(&s->vdev, f); + if (ret) { + return ret; + } + while (qemu_get_sbyte(f)) { VirtIOBlockReq *req = virtio_blk_alloc_request(s); qemu_get_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem)); |