]> git.proxmox.com Git - mirror_qemu.git/commitdiff
ppc/xive: Fix uint32_t overflow
authorCédric Le Goater <clg@kaod.org>
Thu, 14 Sep 2023 15:46:50 +0000 (17:46 +0200)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 18 Sep 2023 10:25:24 +0000 (07:25 -0300)
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 <clg@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-ID: <20230914154650.222111-1-clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
hw/intc/pnv_xive.c

index 9b10e905195ae1847166d1b9aa3718a932078277..bda3478b1f84bb6781333091db2ef514b8b9dcbc 100644 (file)
@@ -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);