[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Fix FADT parsing for PM event blocks.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209644192 -3600
# Node ID 806e7fa302640eed99f439087519c3645eb56b78
# Parent  9fd00ff95068a613dac994a6a3d7025d7dd465d9
x86: Fix FADT parsing for PM event blocks.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/acpi/boot.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff -r 9fd00ff95068 -r 806e7fa30264 xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c  Thu May 01 11:34:56 2008 +0100
+++ b/xen/arch/x86/acpi/boot.c  Thu May 01 13:16:32 2008 +0100
@@ -465,15 +465,18 @@ static void __init
 static void __init
 acpi_fadt_parse_reg(struct acpi_table_fadt *fadt)
 {
-       memcpy(&acpi_gbl_FADT, fadt, sizeof(acpi_gbl_FADT));
-
-       memcpy(&acpi_gbl_xpm1a_enable, &(fadt->xpm1a_event_block),
-               sizeof(acpi_gbl_xpm1a_enable));
-       memcpy(&acpi_gbl_xpm1b_enable, &(fadt->xpm1b_event_block),
-               sizeof(acpi_gbl_xpm1b_enable));
-
-       acpi_gbl_xpm1a_enable.address += 2;
-       acpi_gbl_xpm1b_enable.address += 2;
+       unsigned int len = min(fadt->header.length, sizeof(*fadt));
+
+       memcpy(&acpi_gbl_FADT, fadt, len);
+
+       if (len > offsetof(struct acpi_table_fadt, xpm1b_event_block)) {
+               memcpy(&acpi_gbl_xpm1a_enable, &fadt->xpm1a_event_block,
+                      sizeof(acpi_gbl_xpm1a_enable));
+               memcpy(&acpi_gbl_xpm1b_enable, &fadt->xpm1b_event_block,
+                      sizeof(acpi_gbl_xpm1b_enable));
+               acpi_gbl_xpm1a_enable.address += 2;
+               acpi_gbl_xpm1b_enable.address += 2;
+       }
 }
 
 static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
@@ -523,11 +526,11 @@ static int __init acpi_parse_fadt(unsign
        acpi_enable_value  = fadt->acpi_enable;
        acpi_disable_value = fadt->acpi_disable;
 
+       acpi_fadt_parse_reg(fadt);
+
 #ifdef CONFIG_ACPI_SLEEP
        acpi_fadt_parse_sleep_info(fadt);
 #endif
-
-       acpi_fadt_parse_reg(fadt);
 
        return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.