aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-01-18 10:08:49 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2018-01-22 11:54:58 -0800
commit847a6473206607bc6c84f6c537a0fe603ff7aaa6 (patch)
tree0772370b77db0673865993020d43121a7eca1152 /target/xtensa
parent251634f4ce589d17eb0a14e36c65090713eb9e56 (diff)
target/xtensa: disas/xtensa: fix coverity warnings
Coverity warnings CID 1385146, 1385148 1385149 and 1385150 point that xtensa_opcode_num_operands and xtensa_format_num_slots may return -1 even when xtensa_opcode_decode and xtensa_format_decode succeed. In that case unsigned counters used to iterate through operands/slots will not do the right thing. Make counters and loop bounds signed to fix the warnings. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa')
-rw-r--r--target/xtensa/translate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 4bdfcd24d0..3f439203ac 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -942,7 +942,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)
unsigned char b[MAX_INSN_LENGTH] = {cpu_ldub_code(env, dc->pc)};
unsigned len = xtensa_op0_insn_len(dc, b[0]);
xtensa_format fmt;
- unsigned slot, slots;
+ int slot, slots;
unsigned i;
if (len == XTENSA_UNDEFINED) {
@@ -969,7 +969,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc)
slots = xtensa_format_num_slots(isa, fmt);
for (slot = 0; slot < slots; ++slot) {
xtensa_opcode opc;
- unsigned opnd, vopnd, opnds;
+ int opnd, vopnd, opnds;
uint32_t raw_arg[MAX_OPCODE_ARGS];
uint32_t arg[MAX_OPCODE_ARGS];
XtensaOpcodeOps *ops;