aboutsummaryrefslogtreecommitdiff
path: root/disas
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2012-07-16 19:05:59 +0200
committerMichael Walle <michael@walle.cc>2013-03-18 19:40:34 +0100
commitab2b9f174db088633922eaa82c2bcffd84e6bb94 (patch)
tree1688c762fcef587f85c5d4d6d06c9bd61c1c9b2a /disas
parentb92e062a6f53251feef0969135b539d1fb33f7d6 (diff)
lm32-dis: fix NULL pointer dereference
Signed-off-by: Michael Walle <michael@walle.cc>
Diffstat (limited to 'disas')
-rw-r--r--disas/lm32.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/disas/lm32.c b/disas/lm32.c
index a8eefe05b1..1718c86e1c 100644
--- a/disas/lm32.c
+++ b/disas/lm32.c
@@ -303,11 +303,11 @@ int print_insn_lm32(bfd_vma memaddr, struct disassemble_info *info)
}
case 'c': {
uint8_t csr;
- const char *csr_name;
+ const Lm32CsrInfo *info;
csr = (op >> 21) & 0x1f;
- csr_name = find_csr_info(csr)->name;
- if (csr_name) {
- fprintf_fn(stream, "%s", csr_name);
+ info = find_csr_info(csr);
+ if (info) {
+ fprintf_fn(stream, "%s", info->name);
} else {
fprintf_fn(stream, "0x%x", csr);
}