From: Cédric Le Goater Date: Thu, 14 Sep 2023 15:46:50 +0000 (+0200) Subject: ppc/xive: Fix uint32_t overflow X-Git-Tag: v8.2.0-rc0~122^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=527b23832930bd17338093725cb9b95203b60742;p=thirdparty%2Fqemu.git ppc/xive: Fix uint32_t overflow As reported by Coverity, "idx << xive->pc_shift" is evaluated using 32-bit arithmetic, and then used in a context expecting a "uint64_t". Add a uint64_t cast. Fixes: Coverity CID 1519049 Fixes: b68147b7a5bf ("ppc/xive: Add support for the PC MMIOs") Signed-off-by: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Frederic Barrat Message-ID: <20230914154650.222111-1-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 9b10e905195..bda3478b1f8 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -210,7 +210,7 @@ static uint64_t pnv_xive_vst_addr_remote(PnvXive *xive, uint32_t type, return 0; } - remote_addr |= idx << xive->pc_shift; + remote_addr |= ((uint64_t)idx) << xive->pc_shift; vst_addr = address_space_ldq_be(&address_space_memory, remote_addr, MEMTXATTRS_UNSPECIFIED, &result);