Skip to content

Commit

Permalink
disas/cris.c: Fix Coverity warning about unchecked NULL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pm215 authored and Michael Tokarev committed Jan 24, 2017
1 parent 4382fa6 commit e110788
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion disas/cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e110788

Please sign in to comment.