[coreboot-gerrit] Patch set updated for coreboot: cbfstool: test for duplicate files earlier

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Aug 13 10:27:25 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11212

-gerrit

commit b8ecae1f25c5017f78cddd54c8c08783573a5086
Author: Patrick Georgi <pgeorgi at 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 at 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);



More information about the coreboot-gerrit mailing list