From patchwork Thu May 19 10:25:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9126161 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F3E6BF29F for ; Thu, 19 May 2016 10:26:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9F1720219 for ; Thu, 19 May 2016 10:26:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3CC7420218 for ; Thu, 19 May 2016 10:26:54 +0000 (UTC) Received: from localhost ([::1]:49245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3LAL-0005CI-9l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 06:26:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3L9o-0005AP-Hk for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3L9i-0005Sd-Hr for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:20 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3L9i-0005SY-DB for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:14 -0400 Received: by mail-qk0-x243.google.com with SMTP id i7so7121684qkd.1 for ; Thu, 19 May 2016 03:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ObazJKJWCAokQJEWPsdeKI/bOqQbY2+/+91c6+vjrn0=; b=XCKgUOZ+zY3FByX9W5xGwhjDuZspHEF75vP6HMXelv2GO9Gyzv+45KbZ5vrg/Xg8ia WXIHJr2+D8eHr2E1BRNcbrjsFDNM9jPb+/NT3Ws1d9O9TFaegohgGK1aiHMgz1W9cjSP p169vieCf34Lal+ZX6JwTMnu5D6qIkxMqEciGu+Zh0S13tWJcGnFcG4eCe7fgr4DEGql Zjcs2Fm4Bnaa+WTqXunq6dn/zkRWoW+Y0EGHCux2890yGFVwwrwVoRCy24Rqp0V4b/R4 2hNxaXHyZme8JrzDOak8yE6byXiixvTipTjFZMdbXDymsRp8/DeQLWoiwAf6txomdGKC E4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ObazJKJWCAokQJEWPsdeKI/bOqQbY2+/+91c6+vjrn0=; b=IgA9Z7FBxHIDc1r5tueMTytHVmm7aowLs7ckQMaugX67lAeRfK1DEcJlzfs9aIbK1P B5E2vDbD5K0Awt+9CDt6Vao4gMKVjAhB8ShrI7FFbUtc3cWhn5fb/AoGGUkuDmzndneb ObU7hQV2yHtkdWjP6pALC0+YX6HVENCtGF9wWJR0r8iLsRguNW1JgpMXDhhEvfBWZCp1 gucMKIUNXMtz0HbC0WHN/NflxyPFxM7WgquvMCUOrZIBFH08dDJ+m3puk+tL1Tc7pLQs 9rJupzMuo8CHsglpnvgyWyha1duUn0Qt8YCPovMRE3Z+6D+6MDzHQgsIyhUxynnA9jeQ L9UA== X-Gm-Message-State: AOPr4FV2/bPZpBuv10Lok+cE0hJ/A99c/4HPiI/sJzzndj0aicPJycaew8qT6dwhYFbd9A== X-Received: by 10.55.187.67 with SMTP id l64mr13497215qkf.175.1463653574120; Thu, 19 May 2016 03:26:14 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id 76sm6275592qho.16.2016.05.19.03.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 03:26:13 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 12:25:58 +0200 Message-Id: <1463653560-26958-5-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1463653560-26958-1-git-send-email-marcandre.lureau@redhat.com> References: <1463653560-26958-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH 4/6] virtio-gpu: check max_outputs only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau The scanout id should not be above the configured num_scanouts. Signed-off-by: Marc-André Lureau --- hw/display/virtio-gpu-3d.c | 4 ++-- hw/display/virtio-gpu.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 20e8865..433bf93 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; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 77e542f..17933cb 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -465,7 +465,7 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g, pixman_region_init_rect(&flush_region, rf.r.x, rf.r.y, rf.r.width, rf.r.height); - for (i = 0; i < VIRTIO_GPU_MAX_SCANOUT; i++) { + for (i = 0; i < g->conf.max_outputs; i++) { struct virtio_gpu_scanout *scanout; pixman_region16_t region, finalregion; pixman_box16_t *extents; @@ -508,8 +508,7 @@ static void virtio_gpu_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 || - ss.scanout_id >= g->conf.max_outputs) { + 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;