[coreboot-gerrit] New patch to review for coreboot: 3d0595a AMD hudson yangtze: Fix corruption of a global ramstage variable

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sun Oct 6 19:31:58 CEST 2013


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3954

-gerrit

commit 3d0595a65b0e10834f43bb1a93ac22215827af65
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Mon Sep 9 09:23:19 2013 +0300

    AMD hudson yangtze: Fix corruption of a global ramstage variable
    
    A late for loop may reference over the current array allocation
    and corrupt an unrelated global variable. As a quick fix bumb the
    size of the array allocation uniformly to 6.
    
    We missed these boards for commit 9c7d73ca because the arrays
    had been renamed.
    
    Change-Id: Iff2f2a0090d9302576bc72195d2a3f6fa37ce29a
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/mainboard/amd/olivehill/get_bus_conf.c   | 6 ++----
 src/mainboard/amd/olivehill/irq_tables.c     | 2 +-
 src/mainboard/amd/olivehill/mptable.c        | 2 +-
 src/mainboard/amd/parmer/get_bus_conf.c      | 6 ++----
 src/mainboard/amd/parmer/irq_tables.c        | 2 +-
 src/mainboard/amd/parmer/mptable.c           | 2 +-
 src/mainboard/amd/thatcher/get_bus_conf.c    | 6 ++----
 src/mainboard/amd/thatcher/irq_tables.c      | 2 +-
 src/mainboard/amd/thatcher/mptable.c         | 2 +-
 src/mainboard/asrock/imb-a180/get_bus_conf.c | 6 ++----
 src/mainboard/asrock/imb-a180/irq_tables.c   | 2 +-
 src/mainboard/asrock/imb-a180/mptable.c      | 2 +-
 src/mainboard/asus/f2a85-m/get_bus_conf.c    | 6 ++----
 src/mainboard/asus/f2a85-m/irq_tables.c      | 2 +-
 src/mainboard/asus/f2a85-m/mptable.c         | 2 +-
 15 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/src/mainboard/amd/olivehill/get_bus_conf.c b/src/mainboard/amd/olivehill/get_bus_conf.c
index 0d379d5..fb63ace 100644
--- a/src/mainboard/amd/olivehill/get_bus_conf.c
+++ b/src/mainboard/amd/olivehill/get_bus_conf.c
@@ -30,7 +30,7 @@
  * and acpi_tables busnum is default.
  */
 u8 bus_isa;
-u8 bus_yangtze[3];
+u8 bus_yangtze[6];
 u32 apicid_yangtze;
 
 /*
@@ -100,9 +100,7 @@ void get_bus_conf(void)
 
 	sbdn_yangtze = 0;
 
-	for (i = 0; i < 3; i++) {
-		bus_yangtze[i] = 0;
-	}
+	memset(bus_yangtze, 0, sizeof(bus_yangtze));
 
 	for (i = 0; i < 256; i++) {
 		bus_type[i] = 0; /* default ISA bus. */
diff --git a/src/mainboard/amd/olivehill/irq_tables.c b/src/mainboard/amd/olivehill/irq_tables.c
index 9779153..9eb3649 100644
--- a/src/mainboard/amd/olivehill/irq_tables.c
+++ b/src/mainboard/amd/olivehill/irq_tables.c
@@ -44,7 +44,7 @@ static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
 }
 
 extern u8 bus_isa;
-extern u8 bus_yangtze[2];
+extern u8 bus_yangtze[6];
 extern unsigned long sbdn_yangtze;
 
 unsigned long write_pirq_routing_table(unsigned long addr)
diff --git a/src/mainboard/amd/olivehill/mptable.c b/src/mainboard/amd/olivehill/mptable.c
index 118f860..83c0b41 100644
--- a/src/mainboard/amd/olivehill/mptable.c
+++ b/src/mainboard/amd/olivehill/mptable.c
@@ -30,7 +30,7 @@
 
 //-#define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 #define IO_APIC_ID    CONFIG_MAX_CPUS
-extern u8 bus_yangtze[3];
+extern u8 bus_yangtze[6];
 
 extern u32 bus_type[256];
 extern u32 sbdn_yangtze;
diff --git a/src/mainboard/amd/parmer/get_bus_conf.c b/src/mainboard/amd/parmer/get_bus_conf.c
index d1be8b6..c92fea9 100644
--- a/src/mainboard/amd/parmer/get_bus_conf.c
+++ b/src/mainboard/amd/parmer/get_bus_conf.c
@@ -30,7 +30,7 @@
  * and acpi_tables busnum is default.
  */
 u8 bus_isa;
-u8 bus_hudson[3];
+u8 bus_hudson[6];
 u32 apicid_hudson;
 
 /*
@@ -97,9 +97,7 @@ void get_bus_conf(void)
 
 	sbdn_hudson = 0;
 
-	for (i = 0; i < 3; i++) {
-		bus_hudson[i] = 0;
-	}
+	memset(bus_hudson, 0, sizeof(bus_hudson));
 
 	for (i = 0; i < 256; i++) {
 		bus_type[i] = 0; /* default ISA bus. */
diff --git a/src/mainboard/amd/parmer/irq_tables.c b/src/mainboard/amd/parmer/irq_tables.c
index d7e223b..d5339ad 100644
--- a/src/mainboard/amd/parmer/irq_tables.c
+++ b/src/mainboard/amd/parmer/irq_tables.c
@@ -44,7 +44,7 @@ static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
 }
 
 extern u8 bus_isa;
-extern u8 bus_hudson[2];
+extern u8 bus_hudson[6];
 extern unsigned long sbdn_hudson;
 
 unsigned long write_pirq_routing_table(unsigned long addr)
diff --git a/src/mainboard/amd/parmer/mptable.c b/src/mainboard/amd/parmer/mptable.c
index 67f73c4..d106697 100644
--- a/src/mainboard/amd/parmer/mptable.c
+++ b/src/mainboard/amd/parmer/mptable.c
@@ -30,7 +30,7 @@
 
 //-#define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 #define IO_APIC_ID    CONFIG_MAX_CPUS
-extern u8 bus_hudson[3];
+extern u8 bus_hudson[6];
 
 extern u32 bus_type[256];
 extern u32 sbdn_hudson;
diff --git a/src/mainboard/amd/thatcher/get_bus_conf.c b/src/mainboard/amd/thatcher/get_bus_conf.c
index d1be8b6..c92fea9 100644
--- a/src/mainboard/amd/thatcher/get_bus_conf.c
+++ b/src/mainboard/amd/thatcher/get_bus_conf.c
@@ -30,7 +30,7 @@
  * and acpi_tables busnum is default.
  */
 u8 bus_isa;
-u8 bus_hudson[3];
+u8 bus_hudson[6];
 u32 apicid_hudson;
 
 /*
@@ -97,9 +97,7 @@ void get_bus_conf(void)
 
 	sbdn_hudson = 0;
 
-	for (i = 0; i < 3; i++) {
-		bus_hudson[i] = 0;
-	}
+	memset(bus_hudson, 0, sizeof(bus_hudson));
 
 	for (i = 0; i < 256; i++) {
 		bus_type[i] = 0; /* default ISA bus. */
diff --git a/src/mainboard/amd/thatcher/irq_tables.c b/src/mainboard/amd/thatcher/irq_tables.c
index d7e223b..d5339ad 100644
--- a/src/mainboard/amd/thatcher/irq_tables.c
+++ b/src/mainboard/amd/thatcher/irq_tables.c
@@ -44,7 +44,7 @@ static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
 }
 
 extern u8 bus_isa;
-extern u8 bus_hudson[2];
+extern u8 bus_hudson[6];
 extern unsigned long sbdn_hudson;
 
 unsigned long write_pirq_routing_table(unsigned long addr)
diff --git a/src/mainboard/amd/thatcher/mptable.c b/src/mainboard/amd/thatcher/mptable.c
index 8253b2c..10d2fea 100644
--- a/src/mainboard/amd/thatcher/mptable.c
+++ b/src/mainboard/amd/thatcher/mptable.c
@@ -30,7 +30,7 @@
 
 //-#define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 #define IO_APIC_ID    CONFIG_MAX_CPUS
-extern u8 bus_hudson[3];
+extern u8 bus_hudson[6];
 
 extern u32 bus_type[256];
 extern u32 sbdn_hudson;
diff --git a/src/mainboard/asrock/imb-a180/get_bus_conf.c b/src/mainboard/asrock/imb-a180/get_bus_conf.c
index 0d379d5..fb63ace 100644
--- a/src/mainboard/asrock/imb-a180/get_bus_conf.c
+++ b/src/mainboard/asrock/imb-a180/get_bus_conf.c
@@ -30,7 +30,7 @@
  * and acpi_tables busnum is default.
  */
 u8 bus_isa;
-u8 bus_yangtze[3];
+u8 bus_yangtze[6];
 u32 apicid_yangtze;
 
 /*
@@ -100,9 +100,7 @@ void get_bus_conf(void)
 
 	sbdn_yangtze = 0;
 
-	for (i = 0; i < 3; i++) {
-		bus_yangtze[i] = 0;
-	}
+	memset(bus_yangtze, 0, sizeof(bus_yangtze));
 
 	for (i = 0; i < 256; i++) {
 		bus_type[i] = 0; /* default ISA bus. */
diff --git a/src/mainboard/asrock/imb-a180/irq_tables.c b/src/mainboard/asrock/imb-a180/irq_tables.c
index 9779153..9eb3649 100644
--- a/src/mainboard/asrock/imb-a180/irq_tables.c
+++ b/src/mainboard/asrock/imb-a180/irq_tables.c
@@ -44,7 +44,7 @@ static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
 }
 
 extern u8 bus_isa;
-extern u8 bus_yangtze[2];
+extern u8 bus_yangtze[6];
 extern unsigned long sbdn_yangtze;
 
 unsigned long write_pirq_routing_table(unsigned long addr)
diff --git a/src/mainboard/asrock/imb-a180/mptable.c b/src/mainboard/asrock/imb-a180/mptable.c
index 118f860..83c0b41 100644
--- a/src/mainboard/asrock/imb-a180/mptable.c
+++ b/src/mainboard/asrock/imb-a180/mptable.c
@@ -30,7 +30,7 @@
 
 //-#define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 #define IO_APIC_ID    CONFIG_MAX_CPUS
-extern u8 bus_yangtze[3];
+extern u8 bus_yangtze[6];
 
 extern u32 bus_type[256];
 extern u32 sbdn_yangtze;
diff --git a/src/mainboard/asus/f2a85-m/get_bus_conf.c b/src/mainboard/asus/f2a85-m/get_bus_conf.c
index d1be8b6..c92fea9 100644
--- a/src/mainboard/asus/f2a85-m/get_bus_conf.c
+++ b/src/mainboard/asus/f2a85-m/get_bus_conf.c
@@ -30,7 +30,7 @@
  * and acpi_tables busnum is default.
  */
 u8 bus_isa;
-u8 bus_hudson[3];
+u8 bus_hudson[6];
 u32 apicid_hudson;
 
 /*
@@ -97,9 +97,7 @@ void get_bus_conf(void)
 
 	sbdn_hudson = 0;
 
-	for (i = 0; i < 3; i++) {
-		bus_hudson[i] = 0;
-	}
+	memset(bus_hudson, 0, sizeof(bus_hudson));
 
 	for (i = 0; i < 256; i++) {
 		bus_type[i] = 0; /* default ISA bus. */
diff --git a/src/mainboard/asus/f2a85-m/irq_tables.c b/src/mainboard/asus/f2a85-m/irq_tables.c
index d7e223b..d5339ad 100644
--- a/src/mainboard/asus/f2a85-m/irq_tables.c
+++ b/src/mainboard/asus/f2a85-m/irq_tables.c
@@ -44,7 +44,7 @@ static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
 }
 
 extern u8 bus_isa;
-extern u8 bus_hudson[2];
+extern u8 bus_hudson[6];
 extern unsigned long sbdn_hudson;
 
 unsigned long write_pirq_routing_table(unsigned long addr)
diff --git a/src/mainboard/asus/f2a85-m/mptable.c b/src/mainboard/asus/f2a85-m/mptable.c
index 1760303..97df048 100644
--- a/src/mainboard/asus/f2a85-m/mptable.c
+++ b/src/mainboard/asus/f2a85-m/mptable.c
@@ -31,7 +31,7 @@
 
 //-#define IO_APIC_ID    CONFIG_MAX_PHYSICAL_CPUS + 1
 #define IO_APIC_ID    CONFIG_MAX_CPUS
-extern u8 bus_hudson[3];
+extern u8 bus_hudson[6];
 
 extern u32 bus_type[256];
 extern u32 sbdn_hudson;



More information about the coreboot-gerrit mailing list