[U-Boot] [PATCH] tools/kwbimage.c: fix build on m68k

Angelo Dureghello angelo at sysam.it
Wed Dec 3 14:07:11 CET 2014


Compiler still complains about headersz possible uninitialized,
even after last change (switch used).

CROSS_COMPILE=/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/
bin/m68k-linux- ./MAKEALL -a m68k
boards.cfg is up to date. Nothing to do.
Building M52277EVB board...
   text    data     bss     dec     hex filename
 118493   11756    4096  134345   20cc9 ./u-boot
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);
                     ^

Signed-off-by: Angelo Dureghello <angelo at sysam.it>
---
 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.1.1



More information about the U-Boot mailing list