summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-01-09 19:05:59 +0000
committerMichael Tokarev <mjt@tls.msk.ru>2017-01-24 23:26:53 +0300
commite11078846996ded6f824868ae63a0c77031ad64c (patch)
tree0559e3fe50896e4f3c84cdb41def76c03c301c61
parent4382fa6554987d8c10cdd0fafb04191a40c9743e (diff)
downloadfocaccia-qemu-e11078846996ded6f824868ae63a0c77031ad64c.tar.gz
focaccia-qemu-e11078846996ded6f824868ae63a0c77031ad64c.zip
disas/cris.c: Fix Coverity warning about unchecked NULL
Coverity (CID 1005689) warns that we don't check that
spec_reg_info() returned non-NULL before dereferencing.
Add the check, though as the comment notes this is
a can't-really-happen case because the earlier constraint
matching should have ruled out the "unknown reg" case.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--disas/cris.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disas/cris.c b/disas/cris.c
index 08161d1f21..8a1daf936c 100644
--- a/disas/cris.c
+++ b/disas/cris.c
@@ -2490,7 +2490,7 @@ print_with_operands (const struct cris_opcode *opcodep,
 	const struct cris_spec_reg *sregp
 	  = spec_reg_info ((insn >> 12) & 15, disdata->distype);
 
-	if (sregp->name == NULL)
+	if (sregp == NULL || sregp->name == NULL)
 	  /* Should have been caught as a non-match earlier.  */
 	  *tp++ = '?';
 	else