[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2349] 2009-06-20 Robert Millan <address@hidden>
From: |
Robert Millan |
Subject: |
[2349] 2009-06-20 Robert Millan <address@hidden> |
Date: |
Sat, 20 Jun 2009 14:11:46 +0000 |
Revision: 2349
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2349
Author: robertmh
Date: 2009-06-20 14:11:45 +0000 (Sat, 20 Jun 2009)
Log Message:
-----------
2009-06-20 Robert Millan <address@hidden>
* include/grub/i386/loader.h (grub_linux_prot_size)
(grub_linux_tmp_addr, grub_linux_real_addr)
(grub_linux_is_bzimage, grub_linux16_boot): Declare only on
GRUB_MACHINE_PCBIOS.
* util/i386/pc/grub-mkimage.c (compress_kernel): Move
common grub_util_info() call to ...
(generate_image): ... here.
Fix use of uninitialized memory, comparison of signed with
unsigned integers and memory leak.
Remove bogus module address message.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/include/grub/i386/loader.h
trunk/grub2/util/i386/pc/grub-mkimage.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-06-20 03:06:50 UTC (rev 2348)
+++ trunk/grub2/ChangeLog 2009-06-20 14:11:45 UTC (rev 2349)
@@ -1,3 +1,16 @@
+2009-06-20 Robert Millan <address@hidden>
+
+ * include/grub/i386/loader.h (grub_linux_prot_size)
+ (grub_linux_tmp_addr, grub_linux_real_addr)
+ (grub_linux_is_bzimage, grub_linux16_boot): Declare only on
+ GRUB_MACHINE_PCBIOS.
+ * util/i386/pc/grub-mkimage.c (compress_kernel): Move
+ common grub_util_info() call to ...
+ (generate_image): ... here.
+ Fix use of uninitialized memory, comparison of signed with
+ unsigned integers and memory leak.
+ Remove bogus module address message.
+
2009-06-20 Vladimir Serbinenko <address@hidden>
* disk/mdraid_linux.c (GRUB_MOD_FINI): use grub_raid_unregister and not
Modified: trunk/grub2/include/grub/i386/loader.h
===================================================================
--- trunk/grub2/include/grub/i386/loader.h 2009-06-20 03:06:50 UTC (rev
2348)
+++ trunk/grub2/include/grub/i386/loader.h 2009-06-20 14:11:45 UTC (rev
2349)
@@ -22,14 +22,17 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/symbol.h>
+#include <grub/machine/machine.h>
+extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
+extern grub_size_t EXPORT_VAR(grub_os_area_size);
+
+#ifdef GRUB_MACHINE_PCBIOS
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
extern char *EXPORT_VAR(grub_linux_tmp_addr);
extern char *EXPORT_VAR(grub_linux_real_addr);
extern grub_int32_t EXPORT_VAR(grub_linux_is_bzimage);
-extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
-extern grub_size_t EXPORT_VAR(grub_os_area_size);
-
grub_err_t EXPORT_FUNC(grub_linux16_boot) (void);
+#endif
#endif /* ! GRUB_LOADER_CPU_HEADER */
Modified: trunk/grub2/util/i386/pc/grub-mkimage.c
===================================================================
--- trunk/grub2/util/i386/pc/grub-mkimage.c 2009-06-20 03:06:50 UTC (rev
2348)
+++ trunk/grub2/util/i386/pc/grub-mkimage.c 2009-06-20 14:11:45 UTC (rev
2349)
@@ -1,7 +1,7 @@
/* grub-mkimage.c - make a bootable image */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software
Foundation, Inc.
+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software
Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,7 +59,6 @@
lzo_uint size;
char *wrkmem;
- grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size);
if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE)
grub_util_error ("the core image is too small");
@@ -107,7 +106,6 @@
props.pb = 2;
props.numThreads = 1;
- grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size);
if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE)
grub_util_error ("the core image is too small");
@@ -132,7 +130,6 @@
generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
char *memdisk_path, char *config_path)
{
- grub_addr_t module_addr = 0;
char *kernel_img, *boot_img, *core_img;
size_t kernel_size, boot_size, total_module_size, core_size;
size_t memdisk_size = 0, config_size = 0;
@@ -178,6 +175,7 @@
/* Fill in the grub_module_info structure. */
modinfo = (struct grub_module_info *) (kernel_img + kernel_size);
+ memset (modinfo, 0, sizeof (struct grub_module_info));
modinfo->magic = GRUB_MODULE_MAGIC;
modinfo->offset = sizeof (struct grub_module_info);
modinfo->size = total_module_size;
@@ -191,6 +189,7 @@
mod_size = grub_util_get_image_size (p->name);
header = (struct grub_module_header *) (kernel_img + offset);
+ memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_ELF);
header->size = grub_cpu_to_le32 (mod_size + sizeof (*header));
offset += sizeof (*header);
@@ -204,6 +203,7 @@
struct grub_module_header *header;
header = (struct grub_module_header *) (kernel_img + offset);
+ memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_MEMDISK);
header->size = grub_cpu_to_le32 (memdisk_size + sizeof (*header));
offset += sizeof (*header);
@@ -217,6 +217,7 @@
struct grub_module_header *header;
header = (struct grub_module_header *) (kernel_img + offset);
+ memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_CONFIG);
header->size = grub_cpu_to_le32 (config_size + sizeof (*header));
offset += sizeof (*header);
@@ -226,6 +227,7 @@
*(kernel_img + offset - 1) = 0;
}
+ grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size);
compress_kernel (kernel_img, kernel_size + total_module_size,
&core_img, &core_size);
@@ -251,12 +253,6 @@
free (boot_img);
free (boot_path);
- module_addr = (path_list
- ? (GRUB_BOOT_MACHINE_KERNEL_ADDR + GRUB_DISK_SECTOR_SIZE
- + kernel_size)
- : 0);
-
- grub_util_info ("the first module address is 0x%x", module_addr);
*((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE))
= grub_cpu_to_le32 (total_module_size);
*((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE))
@@ -274,9 +270,9 @@
= grub_cpu_to_le32 (-2);
}
- if (core_size > GRUB_MEMORY_MACHINE_UPPER - GRUB_MEMORY_MACHINE_LINK_ADDR)
- grub_util_error ("Core image is too big (%p > %p)\n", core_size,
- GRUB_MEMORY_MACHINE_UPPER - GRUB_MEMORY_MACHINE_LINK_ADDR);
+ if (GRUB_MEMORY_MACHINE_LINK_ADDR + core_size > GRUB_MEMORY_MACHINE_UPPER)
+ grub_util_error ("Core image is too big (%p > %p)\n",
+ GRUB_MEMORY_MACHINE_LINK_ADDR + core_size,
GRUB_MEMORY_MACHINE_UPPER);
grub_util_write_image (core_img, core_size, out);
free (kernel_img);
@@ -415,6 +411,7 @@
if (output)
{
fp = fopen (output, "wb");
+ free (output);
if (! fp)
grub_util_error ("cannot open %s", output);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [2349] 2009-06-20 Robert Millan <address@hidden>,
Robert Millan <=