Blob Blame History Raw
From ab5a005a1cf0d03e88efb2a2853ed4668986a325 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Thu, 28 Feb 2013 13:16:39 +0100
Subject: [PATCH 169/364] 	* grub-core/kern/i386/coreboot/mmap.c
 (grub_linuxbios_table_iterate): 	Fix end of table condition.

---
 ChangeLog                           | 5 +++++
 grub-core/kern/i386/coreboot/mmap.c | 6 ++++--
 include/grub/i386/coreboot/lbio.h   | 8 ++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 21ec9a9..0eb0516 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	* grub-core/kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate):
+	Fix end of table condition.
+
+2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	* grub-core/lib/arg.c (grub_arg_show_help): Move showargs
 	out of its parent.
 
diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c
index ae4af08..47efb72 100644
--- a/grub-core/kern/i386/coreboot/mmap.c
+++ b/grub-core/kern/i386/coreboot/mmap.c
@@ -58,8 +58,10 @@ signature_found:
 
   table_item =
     (grub_linuxbios_table_item_t) ((long) table_header +
-			       (long) table_header->size);
-  for (; table_item->size;
+			       (long) table_header->header_size);
+  for (; table_item < (grub_linuxbios_table_item_t) ((long) table_header
+						     + (long) table_header->header_size
+						     + (long) table_header->table_size);
        table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
     {
       if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
diff --git a/include/grub/i386/coreboot/lbio.h b/include/grub/i386/coreboot/lbio.h
index aa18539..bac5492 100644
--- a/include/grub/i386/coreboot/lbio.h
+++ b/include/grub/i386/coreboot/lbio.h
@@ -22,8 +22,12 @@
 
 struct grub_linuxbios_table_header
 {
-  char signature[4];
-  grub_uint32_t size;
+  grub_uint8_t signature[4];
+  grub_uint32_t header_size;
+  grub_uint32_t header_checksum;
+  grub_uint32_t table_size;
+  grub_uint32_t table_checksum;
+  grub_uint32_t table_entries;
 };
 typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
 
-- 
1.8.1.4