From aa41563483ca5a88afc22985a89df05166302cd2 Mon Sep 17 00:00:00 2001 From: Jakub Czapiga Date: Mon, 1 Aug 2022 16:01:28 +0200 Subject: 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 Change-Id: Ib009212692fb3594a826436df765860f54837154 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66334 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- util/cbfstool/ifittool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/cbfstool/ifittool.c') diff --git a/util/cbfstool/ifittool.c b/util/cbfstool/ifittool.c index 88a973c5afc8..9ea3149fcc95 100644 --- a/util/cbfstool/ifittool.c +++ b/util/cbfstool/ifittool.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) uint32_t addr = 0; size_t topswap_size = 0; enum fit_type fit_type = 0; - uint32_t headeroffset = ~0u; + uint32_t headeroffset = HEADER_OFFSET_UNKNOWN; verbose = 0; -- cgit v1.2.3