From patchwork Tue Jan 24 09:39:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 92328 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1643463qgi; Tue, 24 Jan 2017 02:27:13 -0800 (PST) X-Received: by 10.237.60.122 with SMTP id u55mr27404547qte.41.1485253633197; Tue, 24 Jan 2017 02:27:13 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d12si12814056qtg.321.2017.01.24.02.27.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:47475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVyJi-00041H-LF for patch@linaro.org; Tue, 24 Jan 2017 05:27:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxoU-0001g1-Ee for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:54:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVxoQ-0005j6-Gt for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:54:54 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:37948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxoQ-0005iV-8G; Tue, 24 Jan 2017 04:54:50 -0500 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 20E5E42108; Tue, 24 Jan 2017 12:54:48 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 334B5589; Tue, 24 Jan 2017 12:39:44 +0300 (MSK) Received: (nullmailer pid 12647 invoked by uid 1000); Tue, 24 Jan 2017 09:39:41 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Tue, 24 Jan 2017 12:39:23 +0300 Message-Id: <95d294e069dcfcde3ddeb0a965c8258f98f7dbe6.1485250702.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 19/31] disas/cris.c: Fix Coverity warning about unchecked NULL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Edgar E. Iglesias Signed-off-by: Michael Tokarev --- disas/cris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 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