From 455e22336550365a19f331036e8e45281008b534 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Thu, 25 Jun 2009 15:54:57 +0000 Subject: 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 Acked-by: Ronald G. Minnich git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4370 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/cbfstool/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/cbfstool/fs.c b/util/cbfstool/fs.c index 4f7109a83f..1e4f06907a 100644 --- a/util/cbfstool/fs.c +++ b/util/cbfstool/fs.c @@ -227,7 +227,7 @@ struct cbfs_file * rom_alloc(struct rom *rom, const char *name, unsigned long si 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 @@ int rom_add(struct rom *rom, const char *name, void *buffer, unsigned long addre 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; } -- cgit v1.2.3