qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 19/31] disas/cris.c: Fix Coverity warning about unche


From: Michael Tokarev
Subject: [Qemu-devel] [PULL 19/31] disas/cris.c: Fix Coverity warning about unchecked NULL
Date: Tue, 24 Jan 2017 12:39:23 +0300

From: Peter Maydell <address@hidden>

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 <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
 disas/cris.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/cris.c b/disas/cris.c
index 08161d1..8a1daf9 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
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]