From 7c8d0ce7f48c90654d99f337235fec8c2e7a12db Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 4 Mar 2012 12:13:05 +0100 Subject: [PATCH] * include/grub/i386/linux.h (linux_kernel_header): Fix init_size type. * grub-core/loader/i386/linux.c (grub_cmd_linux): Differentiate between prot_size and prot_file_size. --- ChangeLog | 6 ++++++ grub-core/loader/i386/linux.c | 8 ++++---- include/grub/i386/linux.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf2e3c30d..eb75c8259 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-03 Vladimir Serbinenko + + * include/grub/i386/linux.h (linux_kernel_header): Fix init_size type. + * grub-core/loader/i386/linux.c (grub_cmd_linux): Differentiate between + prot_size and prot_file_size. + 2012-03-03 Vladimir Serbinenko * grub-core/disk/diskfilter.c (is_lv_readable): New argument "easily". diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 15f4bac3a..bc1c81fb8 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -658,7 +658,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), struct linux_kernel_header lh; struct linux_kernel_params *params; grub_uint8_t setup_sects; - grub_size_t real_size, prot_size; + grub_size_t real_size, prot_size, prot_file_size; grub_ssize_t len; int i; grub_size_t align, min_align; @@ -735,7 +735,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; real_size = setup_sects << GRUB_DISK_SECTOR_BITS; - prot_size = grub_file_size (file) - real_size - GRUB_DISK_SECTOR_SIZE; + prot_file_size = grub_file_size (file) - real_size - GRUB_DISK_SECTOR_SIZE; if (grub_le_to_cpu16 (lh.version) >= 0x205 && lh.kernel_alignment != 0 @@ -761,7 +761,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), else { min_align = 0; - prot_size = grub_file_size (file) - real_size - GRUB_DISK_SECTOR_SIZE; + prot_size = prot_file_size; preffered_address = grub_le_to_cpu32 (lh.code32_start); } @@ -971,7 +971,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), maximal_cmdline_size - (sizeof (LINUX_IMAGE) - 1)); - len = prot_size; + len = prot_file_size; if (grub_file_read (file, prot_mode_mem, len) != len && !grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h index 8e27b93e3..8dde9c227 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -140,7 +140,7 @@ struct linux_kernel_header grub_uint32_t payload_length; grub_uint64_t setup_data; grub_uint64_t pref_address; - grub_uint64_t init_size; + grub_uint32_t init_size; } __attribute__ ((packed)); /* Boot parameters for Linux based on 2.6.12. This is used by the setup