Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11212
-gerrit
commit 748c6fa16cd256662f0eee9b1dc5d52541cb6291 Author: Patrick Georgi pgeorgi@google.com Date: Tue Aug 11 14:35:39 2015 +0200
cbfstool: test for duplicate files earlier
No need to read the file before bailing out.
Change-Id: Ida7226c6ec227e1105724cdb1e5a0927217a69c7 Signed-off-by: Patrick Georgi pgeorgi@google.com --- util/cbfstool/cbfstool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index b6a486f..6a89476 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -190,6 +190,11 @@ static int cbfs_add_component(const char *filename, if (cbfs_image_from_buffer(&image, param.image_region, headeroffset)) return 1;
+ if (cbfs_get_entry(&image, name)) { + ERROR("'%s' already in ROM image.\n", name); + return 1; + } + struct buffer buffer; if (buffer_from_file(&buffer, filename) != 0) { ERROR("Could not load file '%s'.\n", filename); @@ -202,12 +207,6 @@ static int cbfs_add_component(const char *filename, return 1; }
- if (cbfs_get_entry(&image, name)) { - ERROR("'%s' already in ROM image.\n", name); - buffer_delete(&buffer); - return 1; - } - if (IS_TOP_ALIGNED_ADDRESS(offset)) offset = convert_to_from_top_aligned(param.image_region, -offset);