From: Wolfgang Denk Date: Mon, 27 Oct 2014 10:13:55 +0100 Subject: [U-Boot] [PATCH v4 19/20] tools: kwbimage: Add image version 1 support for Armada XP / 370 In-Reply-To: <1413972804-24250-20-git-send-email-sr@denx.de> References: <1413972804-24250-1-git-send-email-sr@denx.de> <1413972804-24250-20-git-send-email-sr@denx.de> Message-ID: <20141027091355.4E16E382FFB@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Stefan, In message <1413972804-24250-20-git-send-email-sr@denx.de> you wrote: > This patch integrates the Barebox version of this kwbimage.c file into > U-Boot. As this version supports the image version 1 type for the > Armada XP / 370 SoCs. This commit causes the following build warning on all boards: tools/kwbimage.c: In function ?kwbimage_set_header?: tools/kwbimage.c:784:8: warning: ?headersz? may be used uninitialized in this function [-Wmaybe-uninitialized] memcpy(ptr, image, headersz); ^ The problem is here: .... > +static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd, > struct image_tool_params *params) > { ... > + size_t headersz; ... > + version = image_get_version(); > + /* Fallback to version 0 is no version is provided in the cfg file */ > + if (version == -1) > + version = 0; > + > + if (version == 0) > + image = image_create_v0(&headersz, params, sbuf->st_size); > + else if (version == 1) > + image = image_create_v1(&headersz, params, sbuf->st_size); If for some reason image_get_version() should return any other result than -1, 0 or 1, then headersz will remain uninitialized. Please fix. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The easiest way to figure the cost of living is to take your income and add ten percent.