All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-gpu: fix potential divide-by-zero regression
@ 2023-07-04  9:19 marcandre.lureau
  2023-07-04  9:23 ` Thomas Huth
  2023-07-04  9:24 ` Alexander Bulekov
  0 siblings, 2 replies; 4+ messages in thread
From: marcandre.lureau @ 2023-07-04  9:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: alxndr, Marc-André Lureau, Gerd Hoffmann,
	Michael S. Tsirkin, Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Commit 9462ff4695aa0 ("virtio-gpu/win32: allocate shareable 2d
resources/images") introduces a division, which can lead to crashes when
"height" is 0.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1744
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu.c  | 4 ++--
 tests/lcitool/libvirt-ci | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 347e17d490..7371a5cbf0 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -324,7 +324,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
         res->image = pixman_image_create_bits(pformat,
                                               c2d.width,
                                               c2d.height,
-                                              bits, res->hostmem / c2d.height);
+                                              bits, c2d.height ? res->hostmem / c2d.height : 0);
 #ifdef WIN32
         if (res->image) {
             pixman_image_set_destroy_function(res->image, win32_pixman_image_destroy, res->handle);
@@ -1292,7 +1292,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
 #endif
         res->image = pixman_image_create_bits(pformat,
                                               res->width, res->height,
-                                              bits, res->hostmem / res->height);
+                                              bits, res->height ? res->hostmem / res->height : 0);
         if (!res->image) {
             g_free(res);
             return -EINVAL;
diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
index b0f44f929a..c8971e90ac 160000
--- a/tests/lcitool/libvirt-ci
+++ b/tests/lcitool/libvirt-ci
@@ -1 +1 @@
-Subproject commit b0f44f929a81c0a604fb7fbf8afc34d37ab0eae9
+Subproject commit c8971e90ac169ee2b539c747f74d96c876debdf9
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio-gpu: fix potential divide-by-zero regression
  2023-07-04  9:19 [PATCH] virtio-gpu: fix potential divide-by-zero regression marcandre.lureau
@ 2023-07-04  9:23 ` Thomas Huth
  2023-07-04  9:25   ` Marc-André Lureau
  2023-07-04  9:24 ` Alexander Bulekov
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2023-07-04  9:23 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel
  Cc: alxndr, Gerd Hoffmann, Michael S. Tsirkin, Alex Bennée,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal

On 04/07/2023 11.19, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Commit 9462ff4695aa0 ("virtio-gpu/win32: allocate shareable 2d
> resources/images") introduces a division, which can lead to crashes when
> "height" is 0.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1744
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
...
> diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
> index b0f44f929a..c8971e90ac 160000
> --- a/tests/lcitool/libvirt-ci
> +++ b/tests/lcitool/libvirt-ci
> @@ -1 +1 @@
> -Subproject commit b0f44f929a81c0a604fb7fbf8afc34d37ab0eae9
> +Subproject commit c8971e90ac169ee2b539c747f74d96c876debdf9

That submodule update looks like an accident?

  Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio-gpu: fix potential divide-by-zero regression
  2023-07-04  9:19 [PATCH] virtio-gpu: fix potential divide-by-zero regression marcandre.lureau
  2023-07-04  9:23 ` Thomas Huth
@ 2023-07-04  9:24 ` Alexander Bulekov
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Bulekov @ 2023-07-04  9:24 UTC (permalink / raw)
  To: marcandre.lureau
  Cc: qemu-devel, Gerd Hoffmann, Michael S. Tsirkin, Alex Bennée,
	Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

On 230704 1119, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Commit 9462ff4695aa0 ("virtio-gpu/win32: allocate shareable 2d
> resources/images") introduces a division, which can lead to crashes when
> "height" is 0.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1744
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Alexander Bulekov <alxndr@bu.edu>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio-gpu: fix potential divide-by-zero regression
  2023-07-04  9:23 ` Thomas Huth
@ 2023-07-04  9:25   ` Marc-André Lureau
  0 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2023-07-04  9:25 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-devel, alxndr, Gerd Hoffmann, Michael S. Tsirkin,
	Alex Bennée, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Tue, Jul 4, 2023 at 11:24 AM Thomas Huth <thuth@redhat.com> wrote:

> On 04/07/2023 11.19, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Commit 9462ff4695aa0 ("virtio-gpu/win32: allocate shareable 2d
> > resources/images") introduces a division, which can lead to crashes when
> > "height" is 0.
> >
> > Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1744
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> ...
> > diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
> > index b0f44f929a..c8971e90ac 160000
> > --- a/tests/lcitool/libvirt-ci
> > +++ b/tests/lcitool/libvirt-ci
> > @@ -1 +1 @@
> > -Subproject commit b0f44f929a81c0a604fb7fbf8afc34d37ab0eae9
> > +Subproject commit c8971e90ac169ee2b539c747f74d96c876debdf9
>
> That submodule update looks like an accident?
>
>
Oops.. thanks for noticing


-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1816 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-04  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04  9:19 [PATCH] virtio-gpu: fix potential divide-by-zero regression marcandre.lureau
2023-07-04  9:23 ` Thomas Huth
2023-07-04  9:25   ` Marc-André Lureau
2023-07-04  9:24 ` Alexander Bulekov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.