fix: tools: kwbimage.c: Initialize headersz to suppress warning
authorŁukasz Majewski <l.majewski@samsung.com>
Fri, 21 Nov 2014 08:22:43 +0000 (09:22 +0100)
committerTom Rini <trini@ti.com>
Sat, 10 Jan 2015 19:09:55 +0000 (14:09 -0500)
When building with my toolchain (4.8.2):
CROSS_COMPILE=/home/lukma/work/ptxdist/toolchains/arm/OSELAS.Toolchain-2013.12.0/arm-v7a-linux-gnueabi/gcc-4.8.2-glibc-2.18-binutils-2.24-kernel-3.12-sanitized/bin/arm-v7a-linux-gnueabi-

I see following WARNING:
tools/kwbimage.c: In function "kwbimage_set_header":
tools/kwbimage.c:803:8: warning: "headersz" may be used uninitialized in this function [-Wmaybe-uninitialized]
  memcpy(ptr, image, headersz);
        ^
This fix aims to suppress it.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
tools/kwbimage.c

index c50f2e2b2494d56c5f34e7660b54b0cb9752597d..2c302e5d4981e94c1969f47703da03062495fd01 100644 (file)
@@ -728,7 +728,7 @@ static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd,
        FILE *fcfg;
        void *image = NULL;
        int version;
-       size_t headersz;
+       size_t headersz = 0;
        uint32_t checksum;
        int ret;
        int size;