From nobody Thu Nov 6 10:24:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540339141062235.2238809084604; Tue, 23 Oct 2018 16:59:01 -0700 (PDT) Received: from localhost ([::1]:44815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6ZU-0001rY-0a for importer@patchew.org; Tue, 23 Oct 2018 19:58:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6JO-0003K9-RW for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:42:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gF6JF-0008F5-Kr for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:42:10 -0400 Received: from [185.30.24.106] (port=13498 helo=hotspot.internet-for-guests.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6JE-0008BD-9G for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:42:01 -0400 Received: from redhat.com (unknown [172.29.18.113]) by hotspot.internet-for-guests.com (Postfix) with ESMTP id 0F16864030B; Wed, 24 Oct 2018 00:41:33 +0100 (BST) Date: Tue, 23 Oct 2018 19:41:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20181023234112.188140-26-mst@redhat.com> References: <20181023234112.188140-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181023234112.188140-1-mst@redhat.com> X-Mailer: git-send-email 2.17.1.1206.gb667731e2e.dirty X-Mutt-Fcc: =sent Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.30.24.106 Subject: [Qemu-devel] [PULL 25/28] i440fx: use ARRAY_SIZE for pam_regions 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: qemu-trivial@nongnu.org, Peter Maydell , Li Qiang , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Li Qiang Cc: qemu-trivial@nongnu.org Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-host/piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 999db824da..82421a86e3 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -142,7 +142,7 @@ static void i440fx_update_memory_mappings(PCII440FXStat= e *d) PCIDevice *pd =3D PCI_DEVICE(d); =20 memory_region_transaction_begin(); - for (i =3D 0; i < 13; i++) { + for (i =3D 0; i < ARRAY_SIZE(d->pam_regions); i++) { pam_update(&d->pam_regions[i], i, pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]); } @@ -412,7 +412,7 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, =20 init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); - for (i =3D 0; i < 12; ++i) { + for (i =3D 0; i < ARRAY_SIZE(f->pam_regions) - 1; ++i) { init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_spac= e, &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); --=20 MST