From nobody Thu Sep 19 02:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549271764522859.6593417560969; Mon, 4 Feb 2019 01:16:04 -0800 (PST) Received: from localhost ([127.0.0.1]:39120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqaM9-0003gk-VA for importer@patchew.org; Mon, 04 Feb 2019 04:15:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqa8f-0000b4-N6 for qemu-devel@nongnu.org; Mon, 04 Feb 2019 04:02:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqa8e-0007cw-78 for qemu-devel@nongnu.org; Mon, 04 Feb 2019 04:02:01 -0500 Received: from ozlabs.org ([203.11.71.1]:41789) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gqa8d-0007FI-OK; Mon, 04 Feb 2019 04:02:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 43tMC73jKJz9sNB; Mon, 4 Feb 2019 20:01:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1549270899; bh=zIHv2j007BwHLwHvlUL2zJTd7liZJCJ7Yve/d+xquVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsgeY8F05qXlhwt5y+jPbZHUMxtPMkIZpncQLfVj0cCv5RmxY/3vKVvVAVPkq915e JoUKFh9ltVukl75hf5J0X0A9l6KCco2Mn8F1FJ04Hz18AKc1mohBKN08iRByEgOB9o DdtpsOAV+zdcueYqZM0wZl/XUpibiBWNs37U/DVI= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 4 Feb 2019 20:00:51 +1100 Message-Id: <20190204090124.26191-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204090124.26191-1-david@gibson.dropbear.id.au> References: <20190204090124.26191-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 04/37] ppc4xx: Use ram_addr_t in ppc4xx_sdram_adjust() 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: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, spopovyc@redhat.com, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan To avoid overflow if larger values are added later use ram_addr_t for the sdram_bank_sizes parameter to match ram_size to which it is compared. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/ppc/ppc440_bamboo.c | 2 +- hw/ppc/ppc4xx_devs.c | 4 ++-- hw/ppc/sam460ex.c | 2 +- include/hw/ppc/ppc4xx.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index fc06191588..4b547eaf77 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -49,7 +49,7 @@ =20 #define PPC440EP_SDRAM_NR_BANKS 4 =20 -static const unsigned int ppc440ep_sdram_bank_sizes[] =3D { +static const ram_addr_t ppc440ep_sdram_bank_sizes[] =3D { 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 16 * MiB, 8 * MiB, 0 }; =20 diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c index 9b6e4c60fa..9418478575 100644 --- a/hw/ppc/ppc4xx_devs.c +++ b/hw/ppc/ppc4xx_devs.c @@ -679,12 +679,12 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, i= nt nr_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], - const unsigned int sdram_bank_sizes[]) + const ram_addr_t sdram_bank_sizes[]) { MemoryRegion *ram =3D g_malloc0(sizeof(*ram)); ram_addr_t size_left =3D ram_size; ram_addr_t base =3D 0; - unsigned int bank_size; + ram_addr_t bank_size; int i; int j; =20 diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 03d70ec1e8..7a8c745021 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -77,7 +77,7 @@ #define SDRAM_NR_BANKS 4 =20 /* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */ -static const unsigned int ppc460ex_sdram_bank_sizes[] =3D { +static const ram_addr_t ppc460ex_sdram_bank_sizes[] =3D { 1 * GiB, 512 * MiB, 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 0 }; =20 diff --git a/include/hw/ppc/ppc4xx.h b/include/hw/ppc/ppc4xx.h index 3a2a04c8ce..39a7ba1ce6 100644 --- a/include/hw/ppc/ppc4xx.h +++ b/include/hw/ppc/ppc4xx.h @@ -43,7 +43,7 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int n= r_banks, MemoryRegion ram_memories[], hwaddr ram_bases[], hwaddr ram_sizes[], - const unsigned int sdram_bank_sizes[]); + const ram_addr_t sdram_bank_sizes[]); =20 void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks, MemoryRegion ram_memories[], --=20 2.20.1