Skip to contentSkip to conversation

common: bootm: Add missing check of fit_open_image() return code

PATCH Applied Albert Schwarzkopf 2 participants 2 messages Sep 9, 2020 – Sep 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: bootm: Add missing check of fit_open_image() return code

Check the return code of fit_open_image() inside bootm_load_initrd(). Without this check, the code works with undefined values of "initrd_size" and "initrd" should fit_open_image() fail.

---
 common/bootm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/bootm.c +5 -1
index 7f22ca5ce..5713edad3 100644
@@ -232,7 +232,11 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
 
 		ret = fit_open_image(data->os_fit, data->fit_config, "ramdisk",
 				     &initrd, &initrd_size);
-
+		if (ret) {
+			pr_err("Cannot open ramdisk image in FIT image: %s\n",
+					strerror(-ret));
+			return ret;
+		}
 		data->initrd_res = request_sdram_region("initrd",
 				load_address,
 				initrd_size);
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 8 lines · Albert Schwarzkopf

Check the return code of fit_open_image() inside bootm_load_initrd(). Without this check, the code works with undefined values of "initrd_size" and "initrd" should fit_open_image() fail.

---
 common/bootm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox