kwbimage: Fix check variable of checksum
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>
Tue, 10 May 2011 17:33:08 +0000 (17:33 +0000)
committerWolfgang Denk <wd@denx.de>
Thu, 12 May 2011 21:53:41 +0000 (23:53 +0200)
calc_hdrcsum two times are checked. checksumi of exthdr is not checked.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
CC: Prafulla Wadaskar <prafulla@marvell.com>
tools/kwbimage.c

index 964796e..f327b07 100644 (file)
@@ -356,7 +356,7 @@ static int kwbimage_verify_header (unsigned char *ptr, int image_size,
 
        calc_exthdrcsum = kwbimage_checksum8 ((void *)exthdr,
                        sizeof(extbhr_t) - sizeof(uint8_t), 0);
 
        calc_exthdrcsum = kwbimage_checksum8 ((void *)exthdr,
                        sizeof(extbhr_t) - sizeof(uint8_t), 0);
-       if (calc_hdrcsum != mhdr->checkSum)
+       if (calc_exthdrcsum != exthdr->checkSum)
                return -FDT_ERR_BADSTRUCTURE; /* exthdr csum not matched */
 
        return 0;
                return -FDT_ERR_BADSTRUCTURE; /* exthdr csum not matched */
 
        return 0;