From 2fe760554eb3769d70f608a158474f728ba45ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 19 May 2016 12:25:58 +0200 Subject: virtio-gpu: check max_outputs only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scanout id should not be above the configured num_scanouts. Signed-off-by: Marc-André Lureau Message-id: 1463653560-26958-5-git-send-email-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-3d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/display/virtio-gpu-3d.c') diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 20e886535b..433bf93024 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -128,7 +128,7 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g, trace_virtio_gpu_cmd_res_flush(rf.resource_id, rf.r.width, rf.r.height, rf.r.x, rf.r.y); - for (i = 0; i < VIRTIO_GPU_MAX_SCANOUT; i++) { + for (i = 0; i < g->conf.max_outputs; i++) { if (g->scanout[i].resource_id != rf.resource_id) { continue; } @@ -147,7 +147,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g, trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id, ss.r.width, ss.r.height, ss.r.x, ss.r.y); - if (ss.scanout_id >= VIRTIO_GPU_MAX_SCANOUT) { + if (ss.scanout_id >= g->conf.max_outputs) { qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d", __func__, ss.scanout_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; -- cgit v1.2.3