grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH vRESEND] MULTIBOOT: Fix handling of errors in broken aout-kludge
@ 2024-05-17  7:53 Vladimir Serbinenko
  2024-06-03 16:49 ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Serbinenko @ 2024-05-17  7:53 UTC (permalink / raw
  To: grub-devel; +Cc: Vladimir Serbinenko

Current code in some codepaths neither discards nor reports
errors. Properly surface the error

While on it split 2 cases of unrelated variables both named err.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/loader/i386/multiboot_mbi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
index fae5d6fb8..bdaf67ad0 100644
--- a/grub-core/loader/i386/multiboot_mbi.c
+++ b/grub-core/loader/i386/multiboot_mbi.c
@@ -69,7 +69,6 @@ static grub_err_t
 load_kernel (grub_file_t file, const char *filename,
 	     char *buffer, struct multiboot_header *header)
 {
-  grub_err_t err;
   mbi_load_data_t mld;
 
   mld.file = file;
@@ -81,12 +80,15 @@ load_kernel (grub_file_t file, const char *filename,
 
   if (grub_multiboot_quirks & GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE)
     {
-      err = grub_multiboot_load_elf (&mld);
+      grub_err_t err = grub_multiboot_load_elf (&mld);
+
       if (err == GRUB_ERR_NONE) {
 	return GRUB_ERR_NONE;
       }
       if (err == GRUB_ERR_UNKNOWN_OS && (header->flags & MULTIBOOT_AOUT_KLUDGE))
-	grub_errno = GRUB_ERR_NONE;
+	grub_errno = err = GRUB_ERR_NONE;
+      if (err != GRUB_ERR_NONE)
+	return err;
     }
   if (header->flags & MULTIBOOT_AOUT_KLUDGE)
     {
@@ -97,6 +99,7 @@ load_kernel (grub_file_t file, const char *filename,
       grub_size_t code_size;
       void *source;
       grub_relocator_chunk_t ch;
+      grub_err_t err;
 
       if (header->bss_end_addr)
 	code_size = (header->bss_end_addr - header->load_addr);
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

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

* Re: [PATCH vRESEND] MULTIBOOT: Fix handling of errors in broken aout-kludge
  2024-05-17  7:53 [PATCH vRESEND] MULTIBOOT: Fix handling of errors in broken aout-kludge Vladimir Serbinenko
@ 2024-06-03 16:49 ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2024-06-03 16:49 UTC (permalink / raw
  To: Vladimir Serbinenko; +Cc: grub-devel

On Fri, May 17, 2024 at 10:53:27AM +0300, Vladimir Serbinenko wrote:
> Current code in some codepaths neither discards nor reports
> errors. Properly surface the error
>
> While on it split 2 cases of unrelated variables both named err.
>
> Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

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

end of thread, other threads:[~2024-06-03 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-17  7:53 [PATCH vRESEND] MULTIBOOT: Fix handling of errors in broken aout-kludge Vladimir Serbinenko
2024-06-03 16:49 ` Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).