diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-05-19 12:25:57 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2016-05-23 13:30:03 +0200 |
commit | 5e3d741c6a192b301692a44084f99876f0d6b643 (patch) | |
tree | a9322cb780ff5ce23597f424843423fdb4612152 /hw | |
parent | d0f0c8654a1a97cfa7a19208afc6a6d3d0fb4326 (diff) |
virtio-gpu: check max_outputs value
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/display/virtio-gpu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 64a60f25f8..7114021c38 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, |