[PATCH 08/31] mkimage: Correct checking of configuration node

Simon Glass sjg at chromium.org
Tue Apr 25 01:08:13 CEST 2023


This returns a negative value on error. Update the logic to detect this
and avoid a segfault when the node is not found.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/image-host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/image-host.c b/tools/image-host.c
index 4a24dee8153c..e4e44e33badd 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -1336,8 +1336,10 @@ int fit_check_sign(const void *fit, const void *key,
 	int ret;
 
 	cfg_noffset = fit_conf_get_node(fit, fit_uname_config);
-	if (!cfg_noffset)
+	if (cfg_noffset < 0) {
+		fprintf(stderr, "Configuration node not found\n");
 		return -1;
+	}
 
 	printf("Verifying Hash Integrity for node '%s'... ",
 	       fdt_get_name(fit, cfg_noffset, NULL));
-- 
2.40.0.634.g4ca3ef3211-goog



More information about the U-Boot mailing list