a5bd9f6
From ab5a005a1cf0d03e88efb2a2853ed4668986a325 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Thu, 28 Feb 2013 13:16:39 +0100
a5bd9f6
Subject: [PATCH 169/364] 	* grub-core/kern/i386/coreboot/mmap.c
a5bd9f6
 (grub_linuxbios_table_iterate): 	Fix end of table condition.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                           | 5 +++++
a5bd9f6
 grub-core/kern/i386/coreboot/mmap.c | 6 ++++--
a5bd9f6
 include/grub/i386/coreboot/lbio.h   | 8 ++++++--
a5bd9f6
 3 files changed, 15 insertions(+), 4 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 21ec9a9..0eb0516 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate):
a5bd9f6
+	Fix end of table condition.
a5bd9f6
+
a5bd9f6
+2013-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* grub-core/lib/arg.c (grub_arg_show_help): Move showargs
a5bd9f6
 	out of its parent.
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c
a5bd9f6
index ae4af08..47efb72 100644
a5bd9f6
--- a/grub-core/kern/i386/coreboot/mmap.c
a5bd9f6
+++ b/grub-core/kern/i386/coreboot/mmap.c
a5bd9f6
@@ -58,8 +58,10 @@ signature_found:
a5bd9f6
 
a5bd9f6
   table_item =
a5bd9f6
     (grub_linuxbios_table_item_t) ((long) table_header +
a5bd9f6
-			       (long) table_header->size);
a5bd9f6
-  for (; table_item->size;
a5bd9f6
+			       (long) table_header->header_size);
a5bd9f6
+  for (; table_item < (grub_linuxbios_table_item_t) ((long) table_header
a5bd9f6
+						     + (long) table_header->header_size
a5bd9f6
+						     + (long) table_header->table_size);
a5bd9f6
        table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
a5bd9f6
     {
a5bd9f6
       if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
a5bd9f6
diff --git a/include/grub/i386/coreboot/lbio.h b/include/grub/i386/coreboot/lbio.h
a5bd9f6
index aa18539..bac5492 100644
a5bd9f6
--- a/include/grub/i386/coreboot/lbio.h
a5bd9f6
+++ b/include/grub/i386/coreboot/lbio.h
a5bd9f6
@@ -22,8 +22,12 @@
a5bd9f6
 
a5bd9f6
 struct grub_linuxbios_table_header
a5bd9f6
 {
a5bd9f6
-  char signature[4];
a5bd9f6
-  grub_uint32_t size;
a5bd9f6
+  grub_uint8_t signature[4];
a5bd9f6
+  grub_uint32_t header_size;
a5bd9f6
+  grub_uint32_t header_checksum;
a5bd9f6
+  grub_uint32_t table_size;
a5bd9f6
+  grub_uint32_t table_checksum;
a5bd9f6
+  grub_uint32_t table_entries;
a5bd9f6
 };
a5bd9f6
 typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
a5bd9f6
 
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6