Skip to contentSkip to conversation

Coverity 1390849, Logically dead code

Qemu-devel Richard Henderson 3 participants 3 messages May 24, 2018 – May 25, 2018

lore
Share & tools
lore
#0 lore raw

In the latest Coverity scan, it reports

405 if (csrno >= CSR_MHPMCOUNTER3 && csrno <= CSR_MHPMCOUNTER31) {
406 return 0;
407 }
408#if defined(TARGET_RISCV32)
409 if (csrno >= CSR_MHPMCOUNTER3 && csrno <= CSR_MHPMCOUNTER31) {

CID 1390849 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: return 0U;.

410 return 0;
411 }
412#endif

I believe the condition at op_helper.c:409 should be testing CSR_MHPMCOUNTER3H and CSR_MHPMCOUNTER31H. Must run now, otherwise I'd also send the trivial patch.

r~

#1 lore raw
Quoted 16 lines · Richard Henderson

In the latest Coverity scan, it reports

405 if (csrno >= CSR_MHPMCOUNTER3 && csrno <= CSR_MHPMCOUNTER31) {
406 return 0;
407 }
408#if defined(TARGET_RISCV32)
409 if (csrno >= CSR_MHPMCOUNTER3 && csrno <= CSR_MHPMCOUNTER31) {

CID 1390849 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: return 0U;.

410 return 0;
411 }
412#endif

Quoted 4 lines

I believe the condition at op_helper.c:409 should be testing CSR_MHPMCOUNTER3H
and CSR_MHPMCOUNTER31H. Must run now, otherwise I'd also send the trivial patch.

Thanks! Yes indeed they should be the H versions.

I will send the trivial patch...

#2 lore raw
Quoted 10 lines · Michael Clark
Quoted 6 lines · Richard Henderson

In the latest Coverity scan, it reports

I believe the condition at op_helper.c:409 should be testing CSR_MHPMCOUNTER3H
and CSR_MHPMCOUNTER31H. Must run now, otherwise I'd also send the trivial patch.

Quoted 3 lines

Thanks! Yes indeed they should be the H versions.

I will send the trivial patch...

You might like to sign up to our Coverity Scan project if you aren't already:
https://scan.coverity.com/projects/qemu?tab=overview

It reports a couple of other riscv coverity nits (minor memory leaks).

thanks
-- PMM