From: Gerd Hoffmann Date: Fri, 28 Jun 2019 07:23:57 +0000 (+0200) Subject: virtio-gpu: fix unmap in error path X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a7f85e03b94ffaca75332cddf06426fc85ac611a;p=qemu.git 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 Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek Reviewed-by: Li Qiang Message-id: 20190628072357.31782-1-kraxel@redhat.com --- diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2b0f66b1d6..475a018c02 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;