2005-01-20 Marco Gerards <metgerards@student.han.nl>

* include/grub/mm.h (grub_mm_init_region): Change the type of the
	`unsigned' arguments to `grub_size_t'.
	(grub_malloc): Likewise.
	(grub_realloc): Likewise.
	(grub_memalign): Likewise.
	* kern/i386/dl.c (grub_arch_dl_check_header): Likewise.
	* kern/powerpc/dl.c (grub_arch_dl_check_header): Likewise.
	* util/misc.c (grub_malloc): Likewise.
	(grub_realloc): Likewise.
	* kern/mm.c (get_header_from_pointer): Change the casts to
	`unsigned' into a cast to `grub_size_t'.

	* fs/fshelp.c (grub_fshelp_find_file): The `oldnode' should always
	point to `currnode' when `currnode' is changed.

	* util/grub-emu.c (main): Initialize `progname'.  Reported by Nico
	Schottelius <nico-linux@schottelius.org>.
This commit is contained in:
marco_g 2005-01-20 17:25:39 +00:00
parent d0ff18e182
commit 777aff3957
8 changed files with 35 additions and 13 deletions

View file

@ -1,3 +1,23 @@
2005-01-20 Marco Gerards <metgerards@student.han.nl>
* include/grub/mm.h (grub_mm_init_region): Change the type of the
`unsigned' arguments to `grub_size_t'.
(grub_malloc): Likewise.
(grub_realloc): Likewise.
(grub_memalign): Likewise.
* kern/i386/dl.c (grub_arch_dl_check_header): Likewise.
* kern/powerpc/dl.c (grub_arch_dl_check_header): Likewise.
* util/misc.c (grub_malloc): Likewise.
(grub_realloc): Likewise.
* kern/mm.c (get_header_from_pointer): Change the casts to
`unsigned' into a cast to `grub_size_t'.
* fs/fshelp.c (grub_fshelp_find_file): The `oldnode' should always
point to `currnode' when `currnode' is changed.
* util/grub-emu.c (main): Initialize `progname'. Reported by Nico
Schottelius <nico-linux@schottelius.org>.
2005-01-09 Hollis Blanchard <hollis@penguinppc.org> 2005-01-09 Hollis Blanchard <hollis@penguinppc.org>
* util/powerpc/ieee1275/grub-mkimage.c: Include <string.h>. * util/powerpc/ieee1275/grub-mkimage.c: Include <string.h>.

View file

@ -89,7 +89,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
/* The node is found, stop iterating over the nodes. */ /* The node is found, stop iterating over the nodes. */
type = filetype; type = filetype;
oldnode = currnode == rootnode ? 0 : currnode; oldnode = currnode;
currnode = node; currnode = node;
return 1; return 1;

View file

@ -24,11 +24,11 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/symbol.h> #include <grub/symbol.h>
void grub_mm_init_region (void *addr, unsigned size); void grub_mm_init_region (void *addr, grub_size_t size);
void *EXPORT_FUNC(grub_malloc) (unsigned size); void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
void EXPORT_FUNC(grub_free) (void *ptr); void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, unsigned size); void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (unsigned align, unsigned size); void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
/* For debugging. */ /* For debugging. */
#define MM_DEBUG 1 #define MM_DEBUG 1

View file

@ -25,7 +25,7 @@
/* Check if EHDR is a valid ELF header. */ /* Check if EHDR is a valid ELF header. */
int int
grub_arch_dl_check_header (void *ehdr, unsigned size) grub_arch_dl_check_header (void *ehdr, grub_size_t size)
{ {
Elf32_Ehdr *e = ehdr; Elf32_Ehdr *e = ehdr;

View file

@ -72,12 +72,12 @@ static grub_mm_region_t base;
static void static void
get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
{ {
if ((unsigned) ptr & (GRUB_MM_ALIGN - 1)) if ((grub_addr_t) ptr & (GRUB_MM_ALIGN - 1))
grub_fatal ("unaligned pointer %p", ptr); grub_fatal ("unaligned pointer %p", ptr);
for (*r = base; *r; *r = (*r)->next) for (*r = base; *r; *r = (*r)->next)
if ((unsigned) ptr > (*r)->addr if ((grub_addr_t) ptr > (*r)->addr
&& (unsigned) ptr <= (*r)->addr + (*r)->size) && (grub_addr_t) ptr <= (*r)->addr + (*r)->size)
break; break;
if (! *r) if (! *r)

View file

@ -25,7 +25,7 @@
/* Check if EHDR is a valid ELF header. */ /* Check if EHDR is a valid ELF header. */
int int
grub_arch_dl_check_header (void *ehdr, unsigned size) grub_arch_dl_check_header (void *ehdr, grub_size_t size)
{ {
Elf32_Ehdr *e = ehdr; Elf32_Ehdr *e = ehdr;

View file

@ -136,6 +136,8 @@ main (int argc, char *argv[])
.dev_map = DEFAULT_DEVICE_MAP .dev_map = DEFAULT_DEVICE_MAP
}; };
progname = "grub-emu";
argp_parse (&argp, argc, argv, 0, 0, &args); argp_parse (&argp, argc, argv, 0, 0, &args);
/* More sure there is a root device. */ /* More sure there is a root device. */

View file

@ -206,7 +206,7 @@ grub_util_write_image (const char *img, size_t size, FILE *out)
} }
void * void *
grub_malloc (unsigned size) grub_malloc (grub_size_t size)
{ {
return xmalloc (size); return xmalloc (size);
} }
@ -218,7 +218,7 @@ grub_free (void *ptr)
} }
void * void *
grub_realloc (void *ptr, unsigned size) grub_realloc (void *ptr, grub_size_t size)
{ {
return xrealloc (ptr, size); return xrealloc (ptr, size);
} }