]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/riscv: Fix null pointer dereference in cpu_set_exception_base
authorDjordje Todorovic <Djordje.Todorovic@htecgroup.com>
Thu, 15 Jan 2026 13:01:17 +0000 (13:01 +0000)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 19 Mar 2026 04:29:58 +0000 (14:29 +1000)
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>
target/riscv/cpu.c

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