[U-Boot] [PATCH v4 19/20] tools: kwbimage: Add image version 1 support for Armada XP / 370
Wolfgang Denk
wd at denx.de
Mon Oct 27 10:13:55 CET 2014
Dear Stefan,
In message <1413972804-24250-20-git-send-email-sr at 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.
More information about the U-Boot
mailing list