Blame 0002-hw-arm-boot-fix-uninitialized-scalar-variable-warnin.patch

391fb8
From 366ca14a9ae8210540a7e4f6bb034b4f0d1c458d Mon Sep 17 00:00:00 2001
391fb8
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
391fb8
Date: Thu, 11 Dec 2014 12:07:53 +0000
391fb8
Subject: [PATCH 02/15] hw/arm/boot: fix uninitialized scalar variable warning
391fb8
 reported by coverity
391fb8
391fb8
Coverity reports the 'size' may be used uninitialized, but that can't happen,
391fb8
because the caller has checked "if (binfo->dtb_filename || binfo->get_dtb)"
391fb8
before call 'load_dtb'.
391fb8
391fb8
Here we simply remove the 'if (binfo->get_dtb)' to satisfy coverity.
391fb8
391fb8
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
391fb8
Message-id: 1416826240-12368-1-git-send-email-zhang.zhanghailiang@huawei.com
391fb8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
391fb8
(cherry picked from commit a554ecb49d0021fd8bb0fd4f2f6be807b3c8b54f)
391fb8
---
391fb8
 hw/arm/boot.c | 4 +++-
391fb8
 1 file changed, 3 insertions(+), 1 deletion(-)
391fb8
391fb8
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
391fb8
index 0014c34..e6a3c5b 100644
391fb8
--- a/hw/arm/boot.c
391fb8
+++ b/hw/arm/boot.c
391fb8
@@ -329,6 +329,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
391fb8
  * Returns: the size of the device tree image on success,
391fb8
  *          0 if the image size exceeds the limit,
391fb8
  *          -1 on errors.
391fb8
+ *
391fb8
+ * Note: Must not be called unless have_dtb(binfo) is true.
391fb8
  */
391fb8
 static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
391fb8
                     hwaddr addr_limit)
391fb8
@@ -352,7 +354,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
391fb8
             goto fail;
391fb8
         }
391fb8
         g_free(filename);
391fb8
-    } else if (binfo->get_dtb) {
391fb8
+    } else {
391fb8
         fdt = binfo->get_dtb(binfo, &size);
391fb8
         if (!fdt) {
391fb8
             fprintf(stderr, "Board was unable to create a dtb blob\n");
391fb8
-- 
391fb8
2.1.0
391fb8