aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2011-11-05 13:13:50 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2011-11-07 20:37:11 +0000
commit6fa4c5a456e27ed1446b08a590c0494199c95c8a (patch)
tree148810aeea58fe3da061a1745145ef1282a30b5c /src/target
parent3bab8990635af47de01e86c32a8ee9fe87789190 (diff)
downloadriscv-openocd-6fa4c5a456e27ed1446b08a590c0494199c95c8a.zip
riscv-openocd-6fa4c5a456e27ed1446b08a590c0494199c95c8a.tar.gz
riscv-openocd-6fa4c5a456e27ed1446b08a590c0494199c95c8a.tar.bz2
disassembly: fix access to undefined memory pointer upon unknown instruction
return error message instead. Found by clang. Change-Id: Ica109d077206236a12d007e77cc78061ffd05834 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/169 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/arm_disassembler.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c
index 36566c9..188b6ba 100644
--- a/src/target/arm_disassembler.c
+++ b/src/target/arm_disassembler.c
@@ -280,13 +280,13 @@ static int evaluate_ldc_stc_mcrr_mrrc(uint32_t opcode,
{
instruction->type = ARM_MCRR;
mnemonic = "MCRR";
- }
-
- /* MRRC */
- if ((opcode & 0x0ff00000) == 0x0c500000)
- {
+ } else if ((opcode & 0x0ff00000) == 0x0c500000) {
+ /* MRRC */
instruction->type = ARM_MRRC;
mnemonic = "MRRC";
+ } else {
+ LOG_ERROR("Unknown instruction");
+ return ERROR_FAIL;
}
snprintf(instruction->text, 128,