[coreboot] [PATCH] more intelligent cbfs walker

Patrick Georgi patrick at georgi-clan.de
Sat Apr 25 15:15:45 CEST 2009


Am 25.04.2009 15:06, schrieb Myles Watson:
> OK. I think that would be more clear if we tested foffset. How about
> if (foffset == 0) /* Invalid CBFS entry that would cause an infinite loop */
> 	return NULL;
>
> Or we could just test foffset when we test the magic number.
>    
The problem is that we can't trust _anything_ in that array: there's no 
final entry in the chain, so the data after that is garbage.
You still have an endless loop for (foffset == 4) && (flen == -4)
We could do
if (foffset + flen == 0) return NULL;
but I wonder why we shouldn't just do the full test then, with some 
comment to the same effect as yours above.


Patrick




More information about the coreboot mailing list