From 87ae25ebfddad3b1d58413d17d5e8254060fdb22 Mon Sep 17 00:00:00 2001 From: robertmh Date: Tue, 15 Jan 2008 12:13:45 +0000 Subject: [PATCH] 2008-01-15 Robert Millan * kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain actual size of `available' from grub_ieee1275_get_property(), and restrict parsing to that bound. --- ChangeLog | 6 ++++++ kern/powerpc/ieee1275/openfw.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dbc19d9e..e12a1d731 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-15 Robert Millan + + * kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain + actual size of `available' from grub_ieee1275_get_property(), and + restrict parsing to that bound. + 2008-01-15 Christian Franke * util/grub-emu.c: Replace by . diff --git a/kern/powerpc/ieee1275/openfw.c b/kern/powerpc/ieee1275/openfw.c index d8f7189af..af42eadea 100644 --- a/kern/powerpc/ieee1275/openfw.c +++ b/kern/powerpc/ieee1275/openfw.c @@ -141,6 +141,7 @@ grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t, grub_uint64_t)) grub_ieee1275_phandle_t root; grub_ieee1275_phandle_t memory; grub_uint32_t available[32]; + grub_ssize_t available_size; int address_cells = 1; int size_cells = 1; unsigned int i; @@ -157,13 +158,14 @@ grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t, grub_uint64_t)) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Couldn't find /memory node"); if (grub_ieee1275_get_property (memory, "available", available, - sizeof available, 0)) + sizeof available, &available_size)) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Couldn't examine /memory/available property"); /* Decode each entry and call `hook'. */ i = 0; - while (i < sizeof (available)) + available_size /= sizeof (grub_uint32_t); + while (i < available_size) { grub_uint64_t address; grub_uint64_t size;