hw/riscv: Fix integer overflow in cm_base calculation
Ensure 64-bit arithmetic is used when computing cm_base, avoiding potential integer overflow. Resolves: Coverity CID 1644076 Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260115130110.2825796-2-djordje.todorovic@htecgroup.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Djordje Todorovic committed
Jan 15, 2026 at 13:01 UTC
6802b477e14c34d09fbf095d1d20343b83bc5636
1 file changed
+1
-1
include/hw/riscv/cps.h
+1
-1
@@ -27,7 +27,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(RISCVCPSState, RISCV_CPS)
27
/* The global CM base for the boston-aia model. */
28
#define GLOBAL_CM_BASE 0x16100000
29
/* The CM block is 512 KiB. */
30
-#define CM_SIZE (1 << 19)
30
+#define CM_SIZE (1ULL << 19)
31
32
/*
33
* The mhartid bits has cluster at bit 16, core at bit 4, and hart at