mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
db7cf3a089
Add some fixes for BLS parsing logic and also make 20-grub.install script to query the relative path of the kernel and initramfs images, so BLS can also work when /boot is not a mount point or is a btrfs subvolume. Also pull some build fixes. Resolves: rhbz#1588184 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
69 lines
2.6 KiB
Diff
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/243] 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.1
|
|
|