grub2/0189-Clean-up-some-errors-in-the-linuxefi-loader.patch
Javier Martinez Canillas dc178ac546 Two more fixes for BLS support
- Use version field to sort BLS entries if id field isn't defined
 - Add version field to BLS fragments generated by 20-grub.install

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-05-11 10:13:07 -04:00

69 lines
2.6 KiB
Diff

From 8bdc0c77919ddb9bd588ac45e96c96497683f76c Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 24 May 2017 15:58:18 -0400
Subject: [PATCH 189/238] Clean up some errors in the linuxefi loader
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/i386/efi/linux.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index bed5919cab3..6db5d0bf3a0 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -161,8 +161,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
grub_file_t file = 0;
- struct linux_kernel_header *lh;
- grub_ssize_t len, start, filelen;
+ struct linux_kernel_header *lh = NULL;
+ grub_ssize_t start, filelen;
void *kernel = NULL;
int setup_header_end_offset;
int rc;
@@ -212,18 +212,19 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
- grub_dprintf ("linuxefi", "params = %p\n", (unsigned long) params);
+ grub_dprintf ("linuxefi", "params = %p\n", params);
grub_memset (params, 0, sizeof(*params));
setup_header_end_offset = *((grub_uint8_t *)kernel + 0x201);
- grub_dprintf ("linuxefi", "copying %d bytes from %p to %p\n",
- MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1,
+ grub_dprintf ("linuxefi", "copying %zu bytes from %p to %p\n",
+ MIN((grub_size_t)0x202+setup_header_end_offset,
+ sizeof (*params)) - 0x1f1,
(grub_uint8_t *)kernel + 0x1f1,
(grub_uint8_t *)params + 0x1f1);
grub_memcpy ((grub_uint8_t *)params + 0x1f1,
(grub_uint8_t *)kernel + 0x1f1,
- MIN(0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1);
+ MIN((grub_size_t)0x202+setup_header_end_offset,sizeof (*params)) - 0x1f1);
lh = (struct linux_kernel_header *)params;
grub_dprintf ("linuxefi", "lh is at %p\n", lh);
grub_dprintf ("linuxefi", "checking lh->boot_flag\n");
@@ -297,7 +298,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
handover_offset = lh->handover_offset;
start = (lh->setup_sects + 1) * 512;
- len = grub_file_size(file) - start;
kernel_mem = grub_efi_allocate_pages_max(lh->pref_address,
BYTES_TO_PAGES(lh->init_size));
@@ -343,7 +343,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
loaded = 0;
}
- if (linux_cmdline && !loaded)
+ if (linux_cmdline && lh && !loaded)
grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)
linux_cmdline,
BYTES_TO_PAGES(lh->cmdline_size + 1));
--
2.17.0