From: Leif Lindholm Date: Mon, 25 Jun 2018 17:01:29 +0000 (+0100) Subject: commands/file: Use definitions from arm64/linux.h X-Git-Tag: grub-2.04-rc1~158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b37229f013db1b150082ac130be7c20b3db8cea;p=thirdparty%2Fgrub.git commands/file: Use definitions from arm64/linux.h Clean up code for matching IS_ARM64 slightly by making use of struct linux_arm64_kernel_header and GRUB_LINUX_ARM64_MAGIC_SIGNATURE. Signed-off-by: Leif Lindholm Reviewed-by: Daniel Kiper --- diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c index ab0c9fb96..3ff6d5522 100644 --- a/grub-core/commands/file.c +++ b/grub-core/commands/file.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -405,13 +406,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) } case IS_ARM64_LINUX: { - grub_uint32_t sig; + struct linux_arm64_kernel_header lh; - if (grub_file_seek (file, 0x38) == (grub_size_t) -1) - break; - if (grub_file_read (file, &sig, 4) != 4) + if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) break; - if (sig == grub_cpu_to_le32_compile_time (0x644d5241)) + + if (lh.magic == + grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM64_MAGIC_SIGNATURE)) { ret = 1; break;