[coreboot] [PATCH] more intelligent cbfs walker

Patrick Georgi patrick at georgi-clan.de
Sat Apr 25 14:57:12 CEST 2009


Am 25.04.2009 14:53, schrieb Myles Watson:
> +		unsigned long oldoffset = offset;
> +		offset = ALIGN(offset + foffset + flen, align);
> +		printk_spew("%p\n", offset);
> +		if (offset == oldoffset) return NULL;
> Why do we have this check?  Is there a time when offset ==
> ALIGN(offset + foffset + flen, align)?
>    
offset == ALIGN(offset + 0 + 0, align) // offset is already aligned

If, for some twisted reason, right after the last file, there's a CBFS 
file magic, and otherwise zeroes (and offset is already aligned, which 
it should be), you end up in an endless loop. This test ends it.
> +
>   		if (offset<  0xFFFFFFFF - ntohl(header->romsize))
>   			return NULL;
> I know this line isn't part of your change, but shouldn't we check
> that we're within the file system, not just within the flash?
>    
Good idea. Another issue, another patch.


Patrick




More information about the coreboot mailing list