Received: from eggs.gnu.org ([2001:4830:134:3::10]:35306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6ToH-00039C-8C for qemu-devel@nongnu.org; Mon, 14 Nov 2016 21:49:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6ToF-00007y-6a for qemu-devel@nongnu.org; Mon, 14 Nov 2016 21:49:21 -0500 From: David Gibson Date: Tue, 15 Nov 2016 13:49:01 +1100 Message-Id: <1479178144-28153-17-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1479178144-28153-1-git-send-email-david@gibson.dropbear.id.au> References: <1479178144-28153-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 16/19] ppc/pnv: fix xscom address translation for POWER9 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, clg@kaod.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson From: C=C3=A9dric Le Goater High addresses can overflow the uint32_t pcba variable after the 8byte shift. Signed-off-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/ppc/pnv_xscom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index f466461..8da2718 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -124,8 +124,8 @@ static uint64_t xscom_read(void *opaque, hwaddr addr,= unsigned width) goto complete; } =20 - val =3D address_space_ldq(&chip->xscom_as, pcba << 3, MEMTXATTRS_UNS= PECIFIED, - &result); + val =3D address_space_ldq(&chip->xscom_as, (uint64_t) pcba << 3, + MEMTXATTRS_UNSPECIFIED, &result); if (result !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "XSCOM read failed at @0x%" HWADDR_PRIx " pcba=3D0x%08x\n", addr, pcba); @@ -150,8 +150,8 @@ static void xscom_write(void *opaque, hwaddr addr, ui= nt64_t val, goto complete; } =20 - address_space_stq(&chip->xscom_as, pcba << 3, val, MEMTXATTRS_UNSPEC= IFIED, - &result); + address_space_stq(&chip->xscom_as, (uint64_t) pcba << 3, val, + MEMTXATTRS_UNSPECIFIED, &result); if (result !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "XSCOM write failed at @0x%" HWADDR_PRIx " pcba=3D0x%08x data=3D0x%" PRIx64 "\n= ", --=20 2.7.4