From: Derek Foreman <derek@endlessos.org>
To: grub-devel@gnu.org
Cc: linux@endlessos.org, Derek Foreman <derek@endlessos.org>
Subject: [PATCH] commands/file: Fix array/enum desync
Date: Fri, 26 Feb 2021 12:05:07 -0600 [thread overview]
Message-ID: <20210226180507.395780-1-derek@endlessos.org> (raw)
commit f1957dc8a3347278a095bc8f44197662559a8ba3 added two entries to the
options array, but only 1 entry to the enum. This resulted in everything
after the insertion point being off by one.
This broke at least the 'file --is-hibernated-hiberfil' command.
Bring the two back in sync by splitting the RISCV enum entry into two,
as is done for other architectures.
Signed-off-by: Derek Foreman <derek@endlessos.org>
---
grub-core/commands/file.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c
index 2574e6685..9de00061e 100644
--- a/grub-core/commands/file.c
+++ b/grub-core/commands/file.c
@@ -134,7 +134,8 @@ enum
IS_IA_EFI,
IS_ARM64_EFI,
IS_ARM_EFI,
- IS_RISCV_EFI,
+ IS_RISCV32_EFI,
+ IS_RISCV64_EFI,
IS_HIBERNATED,
IS_XNU64,
IS_XNU32,
@@ -576,7 +577,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
case IS_IA_EFI:
case IS_ARM64_EFI:
case IS_ARM_EFI:
- case IS_RISCV_EFI:
+ case IS_RISCV32_EFI:
+ case IS_RISCV64_EFI:
{
char signature[4];
grub_uint32_t pe_offset;
@@ -622,13 +624,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARMTHUMB_MIXED))
break;
- if (type == IS_RISCV_EFI
+ if ((type == IS_RISCV32_EFI || type == IS_RISCV64_EFI)
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_RISCV64))
/* TODO: Determine bitness dynamically */
break;
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI ||
- type == IS_RISCV_EFI)
+ type == IS_RISCV32_EFI || type == IS_RISCV64_EFI)
{
struct grub_pe64_optional_header o64;
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
--
2.26.2
next reply other threads:[~2021-02-26 18:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 18:05 Derek Foreman [this message]
2021-02-26 19:52 ` [PATCH] commands/file: Fix array/enum desync Daniel Kiper
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=20210226180507.395780-1-derek@endlessos.org \
--to=derek@endlessos.org \
--cc=grub-devel@gnu.org \
--cc=linux@endlessos.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.