diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2013-11-13 14:34:57 -0800 |
---|---|---|
committer | Isaac Christensen <isaac.christensen@se-eng.com> | 2014-09-12 22:07:19 +0200 |
commit | 8f50e53a4bb4c6f4b95398bb57d58f32fecdad93 (patch) | |
tree | 900e2c0b37b068fbf59c0f7a3ab269a301a2da7d /util/cbfstool/cbfstool.c | |
parent | 1b54cc919c362c63630bf134329d7f547ed586fe (diff) |
cbfstool: Fix architecture check when adding payload
In the process of rewriting cbfstool for ARM and using
a new internal API a regression was introduced that would
silently let you add an ARM payload into an x86 CBFS image
and the other way around. This patch fixes cbfstool to
produce an error in that case again.
Change-Id: I37ee65a467d9658d0846c2cf43b582e285f1a8f8
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/176711
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
(cherry picked from commit 8f74f3f5227e440ae46b59f8fd692f679f3ada2d)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6879
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 937b6105b5..33aac88ed9 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -136,20 +136,21 @@ static int cbfs_add_component(const char *cbfs_name, return 1; } + if (cbfs_image_from_file(&image, cbfs_name) != 0) { + ERROR("Could not load ROM image '%s'.\n", cbfs_name); + return 1; + } + if (buffer_from_file(&buffer, filename) != 0) { ERROR("Could not load file '%s'.\n", filename); + cbfs_image_delete(&image); return 1; } if (convert && convert(&buffer, &offset) != 0) { ERROR("Failed to parse file '%s'.\n", filename); buffer_delete(&buffer); - return 1; - } - - if (cbfs_image_from_file(&image, cbfs_name) != 0) { - ERROR("Could not load ROM image '%s'.\n", cbfs_name); - buffer_delete(&buffer); + cbfs_image_delete(&image); return 1; } |