* [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path
@ 2019-06-28 7:23 Gerd Hoffmann
2019-06-28 14:08 ` Laszlo Ersek
2019-06-28 15:31 ` Li Qiang
0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2019-06-28 7:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
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>
---
hw/display/virtio-gpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 2b0f66b1d68d..475a018c027c 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;
--
2.18.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path
2019-06-28 7:23 [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path Gerd Hoffmann
@ 2019-06-28 14:08 ` Laszlo Ersek
2019-06-28 15:31 ` Li Qiang
1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2019-06-28 14:08 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel; +Cc: Michael S. Tsirkin
On 06/28/19 09:23, Gerd Hoffmann wrote:
> 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.
s/acces_len/access_len/
With that:
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thank you!
Laszlo
>
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/display/virtio-gpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 2b0f66b1d68d..475a018c027c 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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path
2019-06-28 7:23 [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path Gerd Hoffmann
2019-06-28 14:08 ` Laszlo Ersek
@ 2019-06-28 15:31 ` Li Qiang
1 sibling, 0 replies; 3+ messages in thread
From: Li Qiang @ 2019-06-28 15:31 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Qemu Developers, Michael S. Tsirkin
Gerd Hoffmann <kraxel@redhat.com> 于2019年6月28日周五 下午3:24写道:
> 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>
>
It is reasonable, so
Reviewed-by: Li Qiang <liq3ea@gmail.com>
btw: Does it break something before this patch?
AFAICS, the 'len' is not used for the unmap, only the 'access_len' is used.
Thanks,
Li Qiang
> ---
> hw/display/virtio-gpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 2b0f66b1d68d..475a018c027c 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;
> --
> 2.18.1
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-28 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28 7:23 [Qemu-devel] [PATCH] virtio-gpu: fix unmap in error path Gerd Hoffmann
2019-06-28 14:08 ` Laszlo Ersek
2019-06-28 15:31 ` Li Qiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).