Author: myles Date: 2009-06-25 17:54:57 +0200 (Thu, 25 Jun 2009) New Revision: 4370
Modified: trunk/coreboot-v2/util/cbfstool/fs.c Log: The problem is that the check to see if we're at the end is never reached. I didn't look into it enough to know why fssize is 32 bytes larger than the offset. There may be another bug here. Maybe something with the CBFS header not being included or excluded from the calculation?
Anyway, this patch fixes it for all cases size > 32.
I also changed the error message so that it doesn't look like the ROM is full just because it can't find room for a file.
Signed-off-by: Myles Watson mylesgw@gmail.com Acked-by: Ronald G. Minnich rminnich@gmail.com
Modified: trunk/coreboot-v2/util/cbfstool/fs.c =================================================================== --- trunk/coreboot-v2/util/cbfstool/fs.c 2009-06-24 00:35:07 UTC (rev 4369) +++ trunk/coreboot-v2/util/cbfstool/fs.c 2009-06-25 15:54:57 UTC (rev 4370) @@ -227,7 +227,7 @@ unsigned long nextoffset, truncoffset; struct cbfs_file *newfile = NULL;
- while (offset < rom->fssize) { + while ((offset + size) < rom->fssize) {
c = (struct cbfs_file *)ROM_PTR(rom, offset);
@@ -406,7 +406,7 @@ c = rom_alloc(rom, name, size, type);
if (c == NULL) { - ERROR("There is no more room in this ROM\n"); + ERROR("There is not enough room in this ROM\n"); return -1; }