target/riscv: Fix null pointer dereference in cpu_set_exception_base
Add missing return statement after logging the error when cs is NULL. Without this, the function continues to dereference the null pointer. Resolves: Coverity CID 1644077 Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260115130110.2825796-3-djordje.todorovic@htecgroup.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Djordje Todorovic committed
Jan 15, 2026 at 13:01 UTC
519f0bdf4c41be49d30bd60a64cd315d6cf32e4e
1 file changed
+1
target/riscv/cpu.c
+1
@@ -83,6 +83,7 @@ void cpu_set_exception_base(int vp_index, target_ulong address)
83
qemu_log_mask(LOG_GUEST_ERROR,
84
"cpu_set_exception_base: invalid vp_index: %u",
85
vp_index);
86
+ return;
87
}
88
cpu = RISCV_CPU(cs);
89
cpu->env.resetvec = address;