From patchwork Mon Dec 5 09:51:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 631054 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2439273pvb; Mon, 5 Dec 2022 02:38:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6PgEiuolVQ5h1LMSpKoj0xaTLSRSw+huGIf/c5xsvQ1Gpac3vjsbTq+QjGZuEGNdLVRtmp X-Received: by 2002:a05:622a:40ca:b0:3a6:328d:ee8e with SMTP id ch10-20020a05622a40ca00b003a6328dee8emr60072996qtb.421.1670236720816; Mon, 05 Dec 2022 02:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670236720; cv=none; d=google.com; s=arc-20160816; b=s1WUE9EPyHKaRyADGFGVuNtvJ6ATcZQsQBICLDQdtF5jVwzI9l0h7+GjZtaGeaGuJL MnLd91ssYwdICSVdBwyaneBhs5UZ5QNHw8coOI0Gd/3LIQDwRdLOKJfpryP/I9X+18r7 KR/i38dHvZahW5PIIgtKrx3p1HTOw8UcEh2zoEdFLd0sSoY9g/2ouqm3DrFXCCHDzGX8 4jNpH57YZcyiidncDopsABqovbOXDFUbWoWTGOnJKJ5kliIoiGYsUitFr6Y5jg2DnHPK dXP81Rygv6yuFOnj0z87KskeR5VzEG1NpJP4HrE2kVv0+MoUnKnVUXJ5VkWlOv5G2tjV hGeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sWawvSWadu0bL+au53S7AJrJqJZVUFdCmV8iHivocyk=; b=ZYwUlbEqcADmGvd964IctvuT1KUwBL35e//0GiZh6q6lF4wQGIat//PKtEkk28T2LV AFyNZH5MUYueH+o3br329UqHQFjYesPUtXL8526fkte4uCrbbEeMXVawa7Est866c9Bw HvBZp5O9ekI5E/M3HgazrWVK2L6Cbf5GR6HH3OdIhl0J910LbaSB0JAxKEMZA0WlExjn fBeulH9NkseX2EUiL844xwJIZzs7unEnzPMHSOaz16DS80i4vEftCWcBkMHJvGMDPD0P qq3XZyQm7y3raf+cTlqwQ1fHPMarRlC+5d2qX9DcnZtd5daUOAyNUkIdeajuEtHA+xMa MOpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C8yFVILy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id hu14-20020a056214234e00b004bb65f4940asi428958qvb.377.2022.12.05.02.38.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Dec 2022 02:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C8yFVILy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p28Ad-00016j-2k; Mon, 05 Dec 2022 04:53:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p28Ab-00015L-Kj for qemu-devel@nongnu.org; Mon, 05 Dec 2022 04:53:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p28Aa-0006Y3-3R for qemu-devel@nongnu.org; Mon, 05 Dec 2022 04:53:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670234031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sWawvSWadu0bL+au53S7AJrJqJZVUFdCmV8iHivocyk=; b=C8yFVILyjXiZ8kqUpyh2yX8GLEPMRRIOjIGzEMcnfkvRVNGsMXW2qkX/5neNej0B30/nYo ZgJ6Eb1BITUaGFfiPUavsvDOV/Lu+nFp/7AgssL+xuWvEWE6WcgDUwq/9kKS62CgtoWnVx jIC0LIzwVgXLkKw9Rc3SRpnDh+g5uVs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-aAy9LTFLPj6yCjW41-Z7hg-1; Mon, 05 Dec 2022 04:53:45 -0500 X-MC-Unique: aAy9LTFLPj6yCjW41-Z7hg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C0F185A588; Mon, 5 Dec 2022 09:53:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id D73122166B29; Mon, 5 Dec 2022 09:53:36 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Fam Zheng , Thomas Huth , Viresh Kumar , Kevin Wolf , Mathieu Poirier , Laurent Vivier , Eric Blake , Richard Henderson , Raphael Norwitz , Stefan Hajnoczi , Juan Quintela , virtio-fs@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , Christian Borntraeger , "Gonglei (Arei)" , qemu-block@nongnu.org, Xiaojuan Yang , Thomas Huth , Ilya Leoshkevich , Eduardo Habkost , Gerd Hoffmann , "Dr. David Alan Gilbert" , Alex Williamson , Eric Farman , Halil Pasic , Peter Maydell , Vladimir Sementsov-Ogievskiy , Jason Wang , Laurent Vivier , Song Gao , qemu-s390x@nongnu.org, Pavel Dovgalyuk , Klaus Jensen , John Snow , Michael Tokarev , qemu-arm@nongnu.org, Paolo Bonzini , "Michael S. Tsirkin" , Keith Busch , David Hildenbrand , qemu-trivial@nongnu.org, Hanna Reitz , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 08/51] hw/display/qxl: Assert memory slot fits in preallocated MemoryRegion Date: Mon, 5 Dec 2022 10:51:45 +0100 Message-Id: <20221205095228.1314-9-quintela@redhat.com> In-Reply-To: <20221205095228.1314-1-quintela@redhat.com> References: <20221205095228.1314-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi Message-Id: <20221128202741.4945-6-philmd@linaro.org> --- hw/display/qxl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 0b21626aad..6772849dec 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1384,6 +1384,7 @@ static int qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta, qxl_set_guest_bug(d, "%s: pci_region = %d", __func__, pci_region); return 1; } + assert(guest_end - pci_start <= memory_region_size(mr)); virt_start = (intptr_t)memory_region_get_ram_ptr(mr); memslot.slot_id = slot_id;