mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Albert Schwarzkopf <a.schwarzkopf@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH] common: bootm: Add missing check of fit_open_image() return code
Date: Wed, 9 Sep 2020 12:54:46 +0200	[thread overview]
Message-ID: <20200909105446.22379-1-a.schwarzkopf@phytec.de> (raw)

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

             reply	other threads:[~2020-09-09 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 10:54 Albert Schwarzkopf [this message]
2020-09-14  8:32 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200909105446.22379-1-a.schwarzkopf@phytec.de \
    --to=a.schwarzkopf@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox