Skip to contentSkip to conversation

common: spl: spl_fit.c: report an error on hash check fail

PATCH New Philippe Reynes 3 participants 3 messages Nov 24, 2020 – Jan 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: spl: spl_fit.c: report an error on hash check fail

When the hash check fails on a loadable image, the SPL/TPL simply jump to the next one. This commit changes this behaviour, when the hash check fails on a loadable image, the function spl_load_simple_fit stops and report an error.

---
 common/spl/spl_fit.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
common/spl/spl_fit.c +5 -2
index 6418062b93..0de4a2b543 100644
@@ -667,8 +667,11 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 
 		ret = spl_load_fit_image(info, sector, fit, base_offset, node,
 					 &image_info);
-		if (ret < 0)
-			continue;
+		if (ret < 0) {
+			printf("%s: can't load image loadables index %d (ret = %d)\n",
+			       __func__, index, ret);
+			return ret;
+		}
 
 		if (!spl_fit_image_get_os(fit, node, &os_type))
 			debug("Loadable is %s\n", genimg_get_os_name(os_type));
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 common: spl: spl_fit.c: report an error on hash check fail

Quoted 10 lines · Philippe Reynes

When the hash check fails on a loadable image, the SPL/TPL simply jump to the next one. This commit changes this behaviour, when the hash check fails on a loadable image, the function spl_load_simple_fit stops and report an error.

---
 common/spl/spl_fit.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

This should have a test. We have sandbox SPL test support now so it should not be too hard.

#2 lore raw

PATCH 1/1 common: spl: spl_fit.c: report an error on hash check fail

In reply to Philippe Reynes
Quoted 7 lines · Philippe Reynes

When the hash check fails on a loadable image, the SPL/TPL simply jump to the next one. This commit changes this behaviour, when the hash check fails on a loadable image, the function spl_load_simple_fit stops and report an error.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/212b3d02/attachment.sig>