Hi Patrick, 

On Sun, 28 Feb 2016, Patrick Wildt wrote:

> Hi,
> 
> unfortunately the end signature check is still not correct.  Consulting
> the spec cleared the confusion of why the check does not work on my ARM
> machines. 
> [...]

Tested on RB600A: boots fine, dmesg unchanged (mod banner).

Note, I don't know if this exercises the code. My debug printf() calls do 
not show in the console ... which is unsurprising as the console is as-yet 
uninitialised (consinit()). 

Patch applied to HEAD, fdt.c:1.12.

best, 
Richard.

> diff --git sys/arch/socppc/socppc/fdt.c sys/arch/socppc/socppc/fdt.c
> index 0dec4fb..8535c33 100644
> --- sys/arch/socppc/socppc/fdt.c
> +++ sys/arch/socppc/socppc/fdt.c
> @@ -60,7 +60,8 @@ fdt_check_head(void *fdt)
>  
>       /* check for end signature on version 17 blob */
>       if ((betoh32(fh->fh_version) >= 17) &&
> -         (betoh32(*(ptr + betoh32(fh->fh_struct_size))) != FDT_END))
> +         (betoh32(*(ptr + (betoh32(fh->fh_struct_off) / 4) +
> +         (betoh32(fh->fh_struct_size) / 4) - 1)) != FDT_END))
>               return 0;
>  
>       return betoh32(fh->fh_version);
> 
> 

Reply via email to