mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] efi: payload: handle NULL return from loadable_view for ramdisk
Date: Thu,  7 May 2026 13:51:12 +0200	[thread overview]
Message-ID: <20260507115114.1367936-1-a.fatoum@barebox.org> (raw)

loadable_view() can return NULL (distinct from ERR_PTR), which is not
caught by IS_ERR().

efi_load_os() already handles this with the ?: ERR_PTR(-ENODATA) pattern,
so apply the same to efi_load_ramdisk().

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 efi/payload/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/payload/bootm.c b/efi/payload/bootm.c
index 30b6fe8977e0..2f9cc3cbf76b 100644
--- a/efi/payload/bootm.c
+++ b/efi/payload/bootm.c
@@ -86,7 +86,7 @@ static int efi_load_ramdisk(struct image_data *data,
 	if (!data->initrd)
 		return 0;
 
-	initrd_mem = loadable_view(data->initrd, initrd_size);
+	initrd_mem = loadable_view(data->initrd, initrd_size) ?: ERR_PTR(-ENODATA);
 	if (IS_ERR(initrd_mem)) {
 		pr_err("Cannot open ramdisk image: %pe\n", initrd_mem);
 		return PTR_ERR(initrd_mem);
-- 
2.47.3




                 reply	other threads:[~2026-05-07 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260507115114.1367936-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --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