diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2022-08-01 16:01:28 +0200 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2022-08-03 23:24:49 +0000 |
commit | aa41563483ca5a88afc22985a89df05166302cd2 (patch) | |
tree | 8d00738e58b0d1421da53baa66ea3a69ce662f8e /util/cbfstool/cbfstool.c | |
parent | 77b2d45c9e4374320e802749e144bf40cb4a3f87 (diff) |
util/cbfstool: Fix truncate command error handling and cbfs_image_from_buffer()
Check return value of cbfs_truncate_space() in cbfs_truncate().
Remove return from cbfs_image_from_buffer() to inform about invalid
image region when incorrect offset header was provided.
Also change header offset provided to mentioned function in
cbfs_expand_to_region() and cbfs_truncate_space() from zero
to HEADER_OFFSET_UNKNOWN, as they do not support images with cbfs master
header.
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: Ib009212692fb3594a826436df765860f54837154
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66334
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 87b5d00f19..c2191d27a5 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -113,7 +113,7 @@ static struct param { .arch = CBFS_ARCHITECTURE_UNKNOWN, .compression = CBFS_COMPRESS_NONE, .hash = VB2_HASH_INVALID, - .headeroffset = ~0, + .headeroffset = HEADER_OFFSET_UNKNOWN, .region_name = SECTION_NAME_PRIMARY_CBFS, .u64val = -1, }; @@ -1738,7 +1738,8 @@ static int cbfs_truncate(void) uint32_t size; int result = cbfs_truncate_space(param.image_region, &size); - printf("0x%x\n", size); + if (!result) + printf("0x%x\n", size); return result; } |