Fix endless loop when trying to add a too large file to CBFS,

and report the correct error code, and a hopefully helpful
error message.


Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4692 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Patrick Georgi
2009-09-30 11:21:18 +00:00
parent 53ad9f585d
commit 56f5fb734b
2 changed files with 37 additions and 32 deletions

View File

@@ -80,7 +80,8 @@ static int cbfs_add(int argc, char **argv)
}
cbfsfile =
create_cbfs_file(cbfsname, filedata, &filesize, type, &base);
add_file_to_cbfs(cbfsfile, filesize, base);
if (add_file_to_cbfs(cbfsfile, filesize, base))
return 1;
writerom(romname, rom, romsize);
return 0;
}
@@ -127,7 +128,8 @@ static int cbfs_add_payload(int argc, char **argv)
cbfsfile =
create_cbfs_file(cbfsname, payload, &filesize,
CBFS_COMPONENT_PAYLOAD, &base);
add_file_to_cbfs(cbfsfile, filesize, base);
if (add_file_to_cbfs(cbfsfile, filesize, base))
return 1;
writerom(romname, rom, romsize);
return 0;
}
@@ -175,7 +177,8 @@ static int cbfs_add_stage(int argc, char **argv)
create_cbfs_file(cbfsname, stage, &filesize,
CBFS_COMPONENT_STAGE, &base);
add_file_to_cbfs(cbfsfile, filesize, base);
if (add_file_to_cbfs(cbfsfile, filesize, base))
return 1;
writerom(romname, rom, romsize);
return 0;
}