summaryrefslogtreecommitdiff
path: root/hw/virtio-balloon.c
diff options
context:
space:
mode:
authorOrit Wassermann <owasserm@redhat.com>2012-05-16 12:21:35 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2012-05-21 15:40:50 -0500
commit2a633c461e96cb9a856292c46917653bd43959c8 (patch)
tree2907c129ba38047391cea14d072594f866479450 /hw/virtio-balloon.c
parenta6c5c84ae25bc68f22725f77d6d77c98af5c4f9e (diff)
downloadqemu-2a633c461e96cb9a856292c46917653bd43959c8.tar.gz
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-balloon.c')
-rw-r--r--hw/virtio-balloon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index ce9d2c9759..075ed87e37 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -211,11 +211,15 @@ static void virtio_balloon_save(QEMUFile *f, void *opaque)
static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOBalloon *s = opaque;
+ int ret;
if (version_id != 1)
return -EINVAL;
- virtio_load(&s->vdev, f);
+ ret = virtio_load(&s->vdev, f);
+ if (ret) {
+ return ret;
+ }
s->num_pages = qemu_get_be32(f);
s->actual = qemu_get_be32(f);