[PATCH u-boot-marvell 07/16] tools: kwbimage: Check the return value of image_headersz_v1()
Pali Rohár
pali at kernel.org
Tue Dec 21 16:54:07 CET 2021
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 at kernel.org>
Reviewed-by: Marek Behún <marek.behun at nic.cz>
---
tools/kwbimage.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index c21ed7b23fcf..7759a5f94098 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1984,6 +1984,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:
--
2.20.1
More information about the U-Boot
mailing list