aboutsummaryrefslogtreecommitdiff
path: root/rust/qemu-api-macros/src
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>2025-01-21 15:48:45 -0300
committerAlistair Francis <alistair.francis@wdc.com>2025-03-04 15:42:53 +1000
commitc1edd5f756788082e70dc23a9d630bbbe8449f2a (patch)
tree0fb90f15689042b84b2c491ed453573a720235ad /rust/qemu-api-macros/src
parente07a89143bb2735858a1eefeb9bcd9eb637e8e8f (diff)
downloadqemu-c1edd5f756788082e70dc23a9d630bbbe8449f2a.zip
qemu-c1edd5f756788082e70dc23a9d630bbbe8449f2a.tar.gz
qemu-c1edd5f756788082e70dc23a9d630bbbe8449f2a.tar.bz2
target/riscv/csr.c: fix deadcode in rmw_xiregi()
Coverity found a DEADCODE issue in rmw_xiregi() claiming that we can't reach 'RISCV_EXCP_VIRT_INSTRUCTION_FAULT' at the 'done' label: > 2652 done: >>>> CID 1590357: Control flow issues (DEADCODE) >>>> Execution cannot reach the expression "RISCV_EXCP_VIRT_INSTRUCTION_FAULT" inside this statement: "return (env->virt_enabled &...". > 2653 return (env->virt_enabled && virt) ? > 2654 RISCV_EXCP_VIRT_INSTRUCTION_FAULT : RISCV_EXCP_ILLEGAL_INST; This happens because 'virt' is being set to 'false' and it will remain as 'false' in any code path where 'done' will be called. The label can be safely reduced to: done: return RISCV_EXCP_ILLEGAL_INST; And that will leave us with the following usage of a 'goto' skipping a single 'return' to do another single 'return': } else { goto done; } return rmw_xireg_csrind(env, csrno, isel, val, new_val, wr_mask); done: return RISCV_EXCP_ILLEGAL_INST; Which we will eliminate it and just do 'return RISCV_EXCP_ILLEGAL_INST' instead. Resolves: Coverity CID 1590357 Fixes: 5e33a20827 ("target/riscv: Support generic CSR indirect access") Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250121184847.2109128-4-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'rust/qemu-api-macros/src')
0 files changed, 0 insertions, 0 deletions