nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0262-Fix-up-linux-params-usage.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Peter Jones <pjones@redhat.com>
f725e3
Date: Tue, 30 May 2017 14:16:07 -0400
f725e3
Subject: [PATCH] Fix up linux params usage...
f725e3
f725e3
Related: rhbz#1310763
f725e3
f725e3
Signed-off-by: Peter Jones <pjones@redhat.com>
f725e3
---
f725e3
 grub-core/loader/i386/linux.c | 5 ++++-
f725e3
 1 file changed, 4 insertions(+), 1 deletion(-)
f725e3
f725e3
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
f725e3
index e3906eb658f..656c75fd7e8 100644
f725e3
--- a/grub-core/loader/i386/linux.c
f725e3
+++ b/grub-core/loader/i386/linux.c
f725e3
@@ -680,6 +680,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
 {
f725e3
   grub_file_t file = 0;
f725e3
   struct linux_kernel_header lh;
f725e3
+  grub_uint8_t *linux_params_ptr;
f725e3
   grub_uint8_t setup_sects;
f725e3
   grub_size_t real_size, prot_size, prot_file_size, kernel_offset;
f725e3
   grub_ssize_t len;
f725e3
@@ -811,6 +812,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
 		      preferred_address))
f725e3
     goto fail;
f725e3
 
f725e3
+
f725e3
   grub_memset (&linux_params, 0, sizeof (linux_params));
f725e3
   grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
f725e3
 
f725e3
@@ -820,7 +822,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
f725e3
 
f725e3
   len = sizeof (linux_params) - sizeof (lh);
f725e3
 
f725e3
-  grub_memcpy (&linux_params + sizeof (lh), kernel + kernel_offset, len);
f725e3
+  linux_params_ptr = (void *)&linux_params;
f725e3
+  grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len);
f725e3
   kernel_offset += len;
f725e3
 
f725e3
   linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;