]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mkimage: ublimage must return if the header is not verified
authorStefano Babic <sbabic@denx.de>
Thu, 15 Sep 2011 23:50:15 +0000 (23:50 +0000)
committerWolfgang Denk <wd@denx.de>
Wed, 5 Oct 2011 20:03:11 +0000 (22:03 +0200)
Each image handler must return a not-zero velue if the
header is not recognized to allow the main program to
iterate to the next handler.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
tools/ublimage.c

index 99874622d057c887032324ef0e4af2381fe689e5..d6b401738af49cbc0605cc70b96c15d4c1299467 100644 (file)
@@ -214,6 +214,11 @@ static int ublimage_check_image_types(uint8_t type)
 static int ublimage_verify_header(unsigned char *ptr, int image_size,
                        struct mkimage_params *params)
 {
+       struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
+
+       if ((ubl_hdr->magic & 0xFFFFFF00) != UBL_MAGIC_BASE)
+               return -1;
+
        return 0;
 }