a5bd9f6
From a275d1fc56fb118a9ebdd48c8680d0b47e3c3c59 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Fri, 5 Apr 2013 11:01:19 +0200
a5bd9f6
Subject: [PATCH 263/364] 	* grub-core/commands/acpi.c: Use sizeof rather
a5bd9f6
 than hardcoding the size.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                 |  4 ++++
a5bd9f6
 grub-core/commands/acpi.c | 12 ++++++------
a5bd9f6
 2 files changed, 10 insertions(+), 6 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 7e2a62f..f90fab4 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,9 @@
a5bd9f6
 2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/commands/acpi.c: Use sizeof rather than hardcoding the size.
a5bd9f6
+
a5bd9f6
+2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	Replace 8 with GRUB_CHAR_BIT in several places when appropriate.
a5bd9f6
 
a5bd9f6
 2013-04-05  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
a5bd9f6
index 4ca8cf7..14f639c 100644
a5bd9f6
--- a/grub-core/commands/acpi.c
a5bd9f6
+++ b/grub-core/commands/acpi.c
a5bd9f6
@@ -365,13 +365,13 @@ setup_common_tables (void)
a5bd9f6
     numoftables++;
a5bd9f6
 
a5bd9f6
   rsdt_addr = rsdt = (struct grub_acpi_table_header *) playground_ptr;
a5bd9f6
-  playground_ptr += sizeof (struct grub_acpi_table_header) + 4 * numoftables;
a5bd9f6
+  playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables;
a5bd9f6
 
a5bd9f6
   rsdt_entry = (grub_uint32_t *) (rsdt + 1);
a5bd9f6
 
a5bd9f6
   /* Fill RSDT header. */
a5bd9f6
   grub_memcpy (&(rsdt->signature), "RSDT", 4);
a5bd9f6
-  rsdt->length = sizeof (struct grub_acpi_table_header) + 4 * numoftables;
a5bd9f6
+  rsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables;
a5bd9f6
   rsdt->revision = 1;
a5bd9f6
   grub_memcpy (&(rsdt->oemid), root_oemid, sizeof (rsdt->oemid));
a5bd9f6
   grub_memcpy (&(rsdt->oemtable), root_oemtable, sizeof (rsdt->oemtable));
a5bd9f6
@@ -419,13 +419,13 @@ setv2table (void)
a5bd9f6
 
a5bd9f6
   /* Create XSDT. */
a5bd9f6
   xsdt = (struct grub_acpi_table_header *) playground_ptr;
a5bd9f6
-  playground_ptr += sizeof (struct grub_acpi_table_header) + 8 * numoftables;
a5bd9f6
+  playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables;
a5bd9f6
 
a5bd9f6
   xsdt_entry = (grub_uint64_t *)(xsdt + 1);
a5bd9f6
   for (cur = acpi_tables; cur; cur = cur->next)
a5bd9f6
     *(xsdt_entry++) = (grub_addr_t) cur->addr;
a5bd9f6
   grub_memcpy (&(xsdt->signature), "XSDT", 4);
a5bd9f6
-  xsdt->length = sizeof (struct grub_acpi_table_header) + 8 * numoftables;
a5bd9f6
+  xsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables;
a5bd9f6
   xsdt->revision = 1;
a5bd9f6
   grub_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid));
a5bd9f6
   grub_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable));
a5bd9f6
@@ -708,11 +708,11 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
a5bd9f6
   /* DSDT. */
a5bd9f6
   playground_size += dsdt_size;
a5bd9f6
   /* RSDT. */
a5bd9f6
-  playground_size += sizeof (struct grub_acpi_table_header) + 4 * numoftables;
a5bd9f6
+  playground_size += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables;
a5bd9f6
   /* RSDPv1. */
a5bd9f6
   playground_size += sizeof (struct grub_acpi_rsdp_v10);
a5bd9f6
   /* XSDT. */
a5bd9f6
-  playground_size += sizeof (struct grub_acpi_table_header) + 8 * numoftables;
a5bd9f6
+  playground_size += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables;
a5bd9f6
   /* RSDPv2. */
a5bd9f6
   playground_size += sizeof (struct grub_acpi_rsdp_v20);
a5bd9f6
 
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6