[U-Boot-Users] [PATCH] Fix initrd length miscalculation in bootm command

Timur Tabi timur at freescale.com
Tue Mar 27 18:30:28 CEST 2007


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




More information about the U-Boot mailing list