qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PULL 3/7] virtio-gpu: check max_outputs value
Date: Mon, 23 May 2016 14:32:39 +0200	[thread overview]
Message-ID: <1464006764-8115-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1464006764-8115-1-git-send-email-kraxel@redhat.com>

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

The value must be less than VIRTIO_GPU_MAX_SCANOUT.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1463653560-26958-4-git-send-email-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 64a60f2..7114021 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -20,6 +20,7 @@
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-bus.h"
 #include "qemu/log.h"
+#include "qapi/error.h"
 
 static struct virtio_gpu_simple_resource*
 virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
@@ -929,6 +930,11 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
     bool have_virgl;
     int i;
 
+    if (g->conf.max_outputs > VIRTIO_GPU_MAX_SCANOUT) {
+        error_setg(errp, "invalid max_outputs > %d", VIRTIO_GPU_MAX_SCANOUT);
+        return;
+    }
+
     g->config_size = sizeof(struct virtio_gpu_config);
     g->virtio_config.num_scanouts = g->conf.max_outputs;
     virtio_init(VIRTIO_DEVICE(g), "virtio-gpu", VIRTIO_ID_GPU,
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-23 12:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 12:32 [Qemu-devel] [PULL 0/7] vga fixes Gerd Hoffmann
2016-05-23 12:32 ` [Qemu-devel] [PULL 1/7] virtio-gpu: check early scanout id Gerd Hoffmann
2016-05-23 12:32 ` [Qemu-devel] [PULL 2/7] virtio-vga: propagate on gpu realized error Gerd Hoffmann
2016-05-23 12:32 ` Gerd Hoffmann [this message]
2016-05-23 12:32 ` [Qemu-devel] [PULL 4/7] virtio-gpu: check max_outputs only Gerd Hoffmann
2016-05-23 12:32 ` [Qemu-devel] [PULL 5/7] virtio-gpu: use VIRTIO_GPU_MAX_SCANOUTS Gerd Hoffmann
2016-05-23 12:32 ` [Qemu-devel] [PULL 6/7] virtio-gpu: fix ui idx check Gerd Hoffmann
2016-05-23 12:32 ` [Qemu-devel] [PULL 7/7] vga: add sr_vbe register set Gerd Hoffmann
2016-05-23 14:52 ` [Qemu-devel] [PULL 0/7] vga fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464006764-8115-4-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).