* grub-core/loader/i386/linux.c (grub_cmd_initrd): Avoid unnecessarry

cast between linux_kernel_header and linux_kernel_params.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-25 17:44:36 +02:00
parent 36498496a0
commit 8645f72c72
2 changed files with 10 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2012-06-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/linux.c (grub_cmd_initrd): Avoid unnecessarry
cast between linux_kernel_header and linux_kernel_params.
2012-06-25 Vladimir Serbinenko <phcoder@gmail.com> 2012-06-25 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/diskfilter.h (grub_raid5_recover_func_t): Use proper * include/grub/diskfilter.h (grub_raid5_recover_func_t): Use proper

View file

@ -1043,7 +1043,6 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_addr_t addr_min, addr_max; grub_addr_t addr_min, addr_max;
grub_addr_t addr; grub_addr_t addr;
grub_err_t err; grub_err_t err;
struct linux_kernel_header *lh;
int i; int i;
int nfiles = 0; int nfiles = 0;
grub_uint8_t *ptr; grub_uint8_t *ptr;
@ -1076,12 +1075,10 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
initrd_pages = (page_align (size) >> 12); initrd_pages = (page_align (size) >> 12);
lh = (struct linux_kernel_header *) &linux_params;
/* Get the highest address available for the initrd. */ /* Get the highest address available for the initrd. */
if (grub_le_to_cpu16 (lh->version) >= 0x0203) if (grub_le_to_cpu16 (linux_params.version) >= 0x0203)
{ {
addr_max = grub_cpu_to_le32 (lh->initrd_addr_max); addr_max = grub_cpu_to_le32 (linux_params.initrd_addr_max);
/* XXX in reality, Linux specifies a bogus value, so /* XXX in reality, Linux specifies a bogus value, so
it is necessary to make sure that ADDR_MAX does not exceed it is necessary to make sure that ADDR_MAX does not exceed
@ -1144,9 +1141,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "Initrd, addr=0x%x, size=0x%x\n", grub_dprintf ("linux", "Initrd, addr=0x%x, size=0x%x\n",
(unsigned) addr, (unsigned) size); (unsigned) addr, (unsigned) size);
lh->ramdisk_image = initrd_mem_target; linux_params.ramdisk_image = initrd_mem_target;
lh->ramdisk_size = size; linux_params.ramdisk_size = size;
lh->root_dev = 0x0100; /* XXX */ linux_params.root_dev = 0x0100; /* XXX */
fail: fail:
for (i = 0; i < nfiles; i++) for (i = 0; i < nfiles; i++)