All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] restrict parsing of `available'
Date: Sun, 13 Jan 2008 21:06:06 +0100	[thread overview]
Message-ID: <20080113200606.GA23059@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]


Another patch for i386-ieee1275.  Again, I'd appreciate if someone can test
it on PowerPC hardware.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

[-- Attachment #2: ieee1275_available_size.diff --]
[-- Type: text/x-diff, Size: 1316 bytes --]


	* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
	actual size of `available' from grub_ieee1275_get_property(), and
	restrict parsing to that bound.

diff -urp grub2/kern/powerpc/ieee1275/openfw.c grub2.available/kern/powerpc/ieee1275/openfw.c
--- grub2/kern/powerpc/ieee1275/openfw.c	2007-12-30 09:52:05.000000000 +0100
+++ grub2.available/kern/powerpc/ieee1275/openfw.c	2008-01-13 21:03:06.000000000 +0100
@@ -141,6 +141,7 @@ grub_err_t grub_available_iterate (int (
   grub_ieee1275_phandle_t root;
   grub_ieee1275_phandle_t memory;
   grub_uint32_t available[32];
+  grub_size_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 (
     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;

             reply	other threads:[~2008-01-13 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-13 20:06 Robert Millan [this message]
2008-01-13 20:17 ` [PATCH] restrict parsing of `available' Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080113200606.GA23059@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.