From: Djordje Todorovic Date: Thu, 15 Jan 2026 13:01:17 +0000 (+0000) Subject: target/riscv: Fix null pointer dereference in cpu_set_exception_base X-Git-Tag: v11.0.0-rc1~11^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=519f0bdf4c41be49d30bd60a64cd315d6cf32e4e;p=thirdparty%2Fqemu.git 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-ID: <20260115130110.2825796-3-djordje.todorovic@htecgroup.com> Signed-off-by: Alistair Francis --- diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index e56470a3748..9be79622f43 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -83,6 +83,7 @@ void cpu_set_exception_base(int vp_index, target_ulong address) qemu_log_mask(LOG_GUEST_ERROR, "cpu_set_exception_base: invalid vp_index: %u", vp_index); + return; } cpu = RISCV_CPU(cs); cpu->env.resetvec = address;