From patchwork Thu Dec 11 12:19:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 42126 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1051C26C6D for ; Thu, 11 Dec 2014 12:26:19 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf3332773lbv.5 for ; Thu, 11 Dec 2014 04:26:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=bOnNSKxAG5SDTrgyBpLnPin1vTpJYgJKWOknwUWaHp0=; b=W2oVif20LTe9cb3cFtRcgrONND1RCb9uZmOZM1wcFH/MFUw3bianbzGeP9s/sv7sBp aHqS2Gnmt/mYbUJBRpp8Cr8JyKvqshw/d1/yn/eAWwwr350MZeRe5r1+DRJ2sPaZ/yLT Fza/CypZiL581RokzgAFp9fQ6fK/khA4bkGoeWGJ5ALKvv95Ky2vEmJlteDxws+C1xW8 KmoDxzwEjOLRC1W5vnLt5MvBsAzXu0JL0WPJeiTl59icVECGADcGnb7Qvry22bxRtOd5 +GSwOaleJkh1iHjA8L0Ns4XdpSZTmjktahJ6RXDB+HxvRyUEbhJrpZVpJLYhXLGjFPIZ MvvA== X-Gm-Message-State: ALoCoQnQTMC/+Vn8GQ7IzlXX+qd/0nKFMv1hlz5TA8oWrIipf3Bci0EmIeFyd+EcStoyarmH18Uw X-Received: by 10.152.170.201 with SMTP id ao9mr451122lac.5.1418300778038; Thu, 11 Dec 2014 04:26:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.98 with SMTP id lf2ls271574lac.16.gmail; Thu, 11 Dec 2014 04:26:17 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr9533379lbb.80.1418300777804; Thu, 11 Dec 2014 04:26:17 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id kt4si1127040lac.71.2014.12.11.04.26.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Dec 2014 04:26:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so4211815lab.3 for ; Thu, 11 Dec 2014 04:26:17 -0800 (PST) X-Received: by 10.112.162.106 with SMTP id xz10mr9563974lbb.91.1418300777727; Thu, 11 Dec 2014 04:26:17 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp505059lbb; Thu, 11 Dec 2014 04:26:16 -0800 (PST) X-Received: by 10.140.27.199 with SMTP id 65mr17779738qgx.24.1418300776012; Thu, 11 Dec 2014 04:26:16 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id gh3si1069529qcb.26.2014.12.11.04.26.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Dec 2014 04:26:16 -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; Received: from localhost ([::1]:50568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2ow-0005jg-Tm for patch@linaro.org; Thu, 11 Dec 2014 07:26:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2j3-0004vf-3P for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz2iy-0007HP-Qn for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:09 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz2iy-0006sg-Jn for qemu-devel@nongnu.org; Thu, 11 Dec 2014 07:20:04 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Xz2iq-0001Aw-Ud for qemu-devel@nongnu.org; Thu, 11 Dec 2014 12:19:56 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 11 Dec 2014 12:19:51 +0000 Message-Id: <1418300395-4348-30-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1418300395-4348-1-git-send-email-peter.maydell@linaro.org> References: <1418300395-4348-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 29/33] hw/arm/boot: fix uninitialized scalar variable warning reported by coverity X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: zhanghailiang Coverity reports the 'size' may be used uninitialized, but that can't happen, because the caller has checked "if (binfo->dtb_filename || binfo->get_dtb)" before call 'load_dtb'. Here we simply remove the 'if (binfo->get_dtb)' to satisfy coverity. Signed-off-by: zhanghailiang Message-id: 1416826240-12368-1-git-send-email-zhang.zhanghailiang@huawei.com Signed-off-by: Peter Maydell --- hw/arm/boot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 0014c34..e6a3c5b 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -329,6 +329,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info) * Returns: the size of the device tree image on success, * 0 if the image size exceeds the limit, * -1 on errors. + * + * Note: Must not be called unless have_dtb(binfo) is true. */ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, hwaddr addr_limit) @@ -352,7 +354,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, goto fail; } g_free(filename); - } else if (binfo->get_dtb) { + } else { fdt = binfo->get_dtb(binfo, &size); if (!fdt) { fprintf(stderr, "Board was unable to create a dtb blob\n");