dcavalca / rpms / grub2

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