From patchwork Thu May 19 10:25:57 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: 9126371 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 05B8FBF29F for ; Thu, 19 May 2016 11:03:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70D4A20222 for ; Thu, 19 May 2016 11:03:35 +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 BD7C5201FE for ; Thu, 19 May 2016 11:03:34 +0000 (UTC) Received: from localhost ([::1]:49258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3LDq-0001C3-2e for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 06:30:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3L9k-00056z-Ud for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3L9g-0005Rz-1N for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:15 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3L9f-0005Rp-TT for qemu-devel@nongnu.org; Thu, 19 May 2016 06:26:11 -0400 Received: by mail-qk0-x243.google.com with SMTP id q184so7131181qkf.0 for ; Thu, 19 May 2016 03:26:11 -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=ONypDQB+qp9LKBPx+yVYrErkAOKXGHxvTGi3hg9lpUA=; b=kalMRt6HFFv21v+ChJU0bVs79AndO8Qabj0NgUwLqiGUxam69Gd8oo900MIMTBtFg0 E+hji95oC/nbc7nbqutz/EZqtkjjbSPgLO9WJGAQAoNdWiimlygwm6ow4p60aiKjHH7F pXF0qDz9+QB6YN+Rhj52GwJYBKkWEvXYBgLXIymQPv1U1JGez8kW/AkQx5wE0lgkhFE6 i3FWhhMDE8MaAqjQlmFhBboIYMRPTkKJRfqERI4NdDUJsdp8k/BgOcjsx6nkdNzM8JlJ axWMBqvXrVOrFcKqu1hjlXWpVfJmAtU47XyZlyP2Dk4ueUjXKuxCx3VAVzmoJcxjRWvH kJfQ== 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=ONypDQB+qp9LKBPx+yVYrErkAOKXGHxvTGi3hg9lpUA=; b=BLdcnVX8IEyXna48qKSt2s7TPlAgoQit0Aj5a0oyfoJVPgdr8b/ByMQzSDrMUrk6cE +JqtHt93YRXfBDJiwaYk4shu67Awyc4V3jsw/Zvc3waNafyh5KZyIpnFpXfEvk6hYIuY a9IV69aC/HFkj3b9F0OOXXrZOuEsubqVuv1JWHVYWalAcSO+vYgC2TEVAy6Wxkd2Xm3S nYYE1WQjy0eeFeKQP95vVi5DTkoT7SchE9WUulZwOY4Dzw3za1C/Qr+QYLgXbdphjma1 zukMjItyLHICwdhOKJwY3kp6qKrmAJ0/JZqI781DVpqeln0qTY/yt90RAwKVw0N5sUfa bDDw== X-Gm-Message-State: AOPr4FV2pnzk+oEVUAdeLP/In88EWFwLcCbhogPVTM77B33HQbhir+7GIegJlBbn2YsBAQ== X-Received: by 10.55.150.5 with SMTP id y5mr13049349qkd.144.1463653571585; Thu, 19 May 2016 03:26:11 -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 q19sm6281003qhb.20.2016.05.19.03.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 03:26:10 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 12:25:57 +0200 Message-Id: <1463653560-26958-4-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 3/6] virtio-gpu: check max_outputs value 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=unavailable 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 value must be less than VIRTIO_GPU_MAX_SCANOUT. Signed-off-by: Marc-André Lureau --- 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 1193838..77e542f 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -19,6 +19,7 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-bus.h" +#include "qapi/error.h" static struct virtio_gpu_simple_resource* virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id); @@ -928,6 +929,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,