Skip to content

Commit 0d4fd57

Browse files
authored
Coverity fixes (#2901)
* Fix CID 643619 * Fix CID 645257
1 parent 1d9a198 commit 0d4fd57

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

arch/RISCV/RISCVBaseInfo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ typedef struct {
3939
unsigned value;
4040
bool isFractional;
4141
} VLMULDecodeResult;
42+
4243
VLMULDecodeResult decodeVLMUL(RISCVII_VLMUL VLMUL)
4344
{
4445
switch (VLMUL) {
4546
default:
4647
CS_ASSERT(0 && "Unexpected LMUL value!");
48+
break;
4749
case RISCVII_LMUL_1:
4850
case RISCVII_LMUL_2:
4951
case RISCVII_LMUL_4:
@@ -61,6 +63,8 @@ VLMULDecodeResult decodeVLMUL(RISCVII_VLMUL VLMUL)
6163
return result;
6264
}
6365
}
66+
VLMULDecodeResult result = { .value = 0, .isFractional = false };
67+
return result;
6468
}
6569

6670
void printVType(unsigned VType, SStream *OS)

tests/unit/riscv_op_count_iter.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ static bool test_riscv_op_count_no_stale()
1616
static const int32_t expected_op_counts[] = { 2, 3, 2 };
1717

1818
csh handle;
19-
cs_open(CS_ARCH_RISCV, CS_MODE_RISCV64 | CS_MODE_RISCV_C, &handle);
19+
if (cs_open(CS_ARCH_RISCV, CS_MODE_RISCV64 | CS_MODE_RISCV_C,
20+
&handle) != CS_ERR_OK) {
21+
return false;
22+
}
2023
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON | CS_OPT_DETAIL_REAL);
2124
cs_option(handle, CS_OPT_SYNTAX,
2225
CS_OPT_SYNTAX_NO_ALIAS_TEXT |

0 commit comments

Comments
 (0)