mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] common: bootm: Add missing check of fit_open_image() return code
@ 2020-09-09 10:54 Albert Schwarzkopf
  2020-09-14  8:32 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Albert Schwarzkopf @ 2020-09-09 10:54 UTC (permalink / raw)
  To: barebox

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.

Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de>
---
 common/bootm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 7f22ca5ce..5713edad3 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -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);
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] common: bootm: Add missing check of fit_open_image() return code
  2020-09-09 10:54 [PATCH] common: bootm: Add missing check of fit_open_image() return code Albert Schwarzkopf
@ 2020-09-14  8:32 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-09-14  8:32 UTC (permalink / raw)
  To: Albert Schwarzkopf; +Cc: barebox

On Wed, Sep 09, 2020 at 12:54:46PM +0200, Albert Schwarzkopf wrote:
> 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.
> 
> Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de>
> ---
>  common/bootm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-14  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 10:54 [PATCH] common: bootm: Add missing check of fit_open_image() return code Albert Schwarzkopf
2020-09-14  8:32 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox