From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Fri, 21 Nov 2014 22:52:27 +0100 Subject: [U-Boot] [PATCH] fix: tools: kwbimage.c: Initialize headersz to suppress warning In-Reply-To: <1416558163-23614-1-git-send-email-l.majewski@samsung.com> References: <1416558163-23614-1-git-send-email-l.majewski@samsung.com> Message-ID: <20141121225227.6aeb5d3d@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Lukasz, On Fri, 21 Nov 2014 09:22:43 +0100, Lukasz Majewski wrote: > 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 > --- > tools/kwbimage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/kwbimage.c b/tools/kwbimage.c > index c50f2e2..2c302e5 100644 > --- a/tools/kwbimage.c > +++ b/tools/kwbimage.c > @@ -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; > -- > 2.0.0.rc2 As I was wondering whether there could not be a better way to prevent the warning, I tried to reproduce the case. I've tried gcc 4.8.3 as well as 4.9.1 and gcc 4.7.4, and none of them emits the warning above. Lukasz, where can I find the toolchain that you are using and which emits the warning? Amicalement, -- Albert.