diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-06-28 09:23:57 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-07-03 08:57:09 +0200 |
commit | a7f85e03b94ffaca75332cddf06426fc85ac611a (patch) | |
tree | 74ba1f18eebadd92f7f39b9c43ec8efffab0c269 /hw | |
parent | 506179e42112be77bfd071f050b15762d3b2cd43 (diff) | |
download | qemu-a7f85e03b94ffaca75332cddf06426fc85ac611a.zip qemu-a7f85e03b94ffaca75332cddf06426fc85ac611a.tar.gz qemu-a7f85e03b94ffaca75332cddf06426fc85ac611a.tar.bz2 |
virtio-gpu: fix unmap in error path
We land here in case not everything we've asked for could be mapped.
So unmap only the bytes which have actually been mapped.
Also we didn't access anything, so acces_len can be 0.
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-id: 20190628072357.31782-1-kraxel@redhat.com
Diffstat (limited to 'hw')
-rw-r--r-- | hw/display/virtio-gpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2b0f66b..475a018 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1048,9 +1048,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size, if (res->iov[i].iov_base) { dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as, res->iov[i].iov_base, - res->iov[i].iov_len, + len, DMA_DIRECTION_TO_DEVICE, - res->iov[i].iov_len); + 0); } /* ...and the mappings for previous loop iterations */ res->iov_cnt = i; |