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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux