Skip to content

Commit

Permalink
fix coverity (#2546)
Browse files Browse the repository at this point in the history
- cid 514642

- cid 514643

- cid 514644

- cid 514645
  • Loading branch information
imbillow authored Nov 13, 2024
1 parent 1ecfb5b commit abbf32b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/LoongArch/LoongArchMapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ void LoongArch_rewrite_memory_operand(MCInst *MI)

const loongarch_suppl_info *suppl_info =
map_get_suppl_info(MI, loongarch_insns);
if (!suppl_info)
return;

if (suppl_info->memory_access == CS_AC_INVALID) {
// not memory instruction
return;
Expand Down
4 changes: 2 additions & 2 deletions arch/Xtensa/XtensaDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static DecodeStatus DecodeMR01RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
const void *Decoder)
{
if (RegNo > 2)
if (RegNo >= ARR_SIZE(MR01DecoderTable))
return MCDisassembler_Fail;

unsigned Reg = MR01DecoderTable[RegNo];
Expand Down Expand Up @@ -970,7 +970,7 @@ static DecodeStatus readInstructionN(const uint8_t *Bytes, size_t BytesLen,

*Insn = 0;
for (unsigned i = 0; i < InstSize; i++)
*Insn |= (Bytes[i] << 8 * i);
*Insn |= (uint64_t)(Bytes[i]) << (8 * i);

*Size = InstSize;
return MCDisassembler_Success;
Expand Down

0 comments on commit abbf32b

Please sign in to comment.