[PATCH v2 07/30] mkimage: Correct checking of configuration node

Simon Glass sjg at chromium.org
Sun Apr 30 03:29:40 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>
---

(no changes since v1)

 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.1.495.gc816e09b53d-goog



More information about the U-Boot mailing list