From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 27 Mar 2007 11:30:28 -0500 Subject: [U-Boot-Users] [PATCH] Fix initrd length miscalculation in bootm command In-Reply-To: References: <20070227205530.6BA37353D06@atlas.denx.de> <45E4AD19.8080601@freescale.com> <45FB10FD.2020007@freescale.com> Message-ID: <460946A4.9070903@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Johns Daniel wrote: > One more note to add to that. The only part of Timur's patch that is > really important is this bit: > @@ -771,9 +767,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl > > checksum = ntohl(hdr->ih_dcrc); > addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t)); > - len = ntohl(hdr->ih_size); > > - if(checksum != crc32(0, (uchar *)addr, len)) { > + if(checksum != crc32(0, (uchar *)addr, > ntohl(hdr->ih_size))) { > printf("ERROR: Flat Device Tree > checksum is invalid\n"); > return; > } > > The "len" variable should not be used for the DTB image. One of the goals of my patch is to make it very clear what 'len' is supposed to be. It is only supposed to be the initrd length. Calling it 'len' is what confused the programmer who added the OF code. He saw 'len' and thought it was a scratch variable. -- Timur Tabi Linux Kernel Developer @ Freescale