aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár2022-01-12 18:20:42 +0100
committerStefan Roese2022-01-14 11:39:16 +0100
commit252e7c3a24fefdf88dfa3fff87e8dc4d0c7aa9cc (patch)
treece3460bd3dc00f7457d273869b5a54c06c3ed302
parent0aca27ea185188a50292dd5bcec07fef020d10e6 (diff)
tools: kwbimage: Check the return value of image_headersz_v1()
Function image_headersz_v1() may return zero on fatal errors. In this case the function already printed an error message. Check the return value of image_headersz_v1() in kwbimage_generate(), and exit on zero value with EXIT_FAILURE. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r--tools/kwbimage.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index c0f1bdac021..a5b518f60bc 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -2029,6 +2029,10 @@ static int kwbimage_generate(struct image_tool_params *params,
case 1:
alloc_len = image_headersz_v1(NULL);
+ if (!alloc_len) {
+ free(image_cfg);
+ exit(EXIT_FAILURE);
+ }
break;
default: