Message ID | 1465324818-14676-1-git-send-email-george.mccollister@gmail.com |
---|---|
State | Accepted |
Commit | 8a1a7595cfbcb12d01a5c1f486ebfd50af90c34c |
Delegated to: | Bin Meng |
Headers | show |
On 7 June 2016 at 12:40, George McCollister <george.mccollister@gmail.com> wrote: > > An accumulated length was incorrectly added to current each pass > through the loop. On system with more than 2 cores this caused a > corrupt MADT to be generated. > > Signed-off-by: George McCollister <george.mccollister@gmail.com> > --- > arch/x86/lib/acpi_table.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Wed, Jun 8, 2016 at 2:40 AM, George McCollister <george.mccollister@gmail.com> wrote: > An accumulated length was incorrectly added to current each pass > through the loop. On system with more than 2 cores this caused a > corrupt MADT to be generated. > > Signed-off-by: George McCollister <george.mccollister@gmail.com> > --- > arch/x86/lib/acpi_table.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
On Wed, Jun 8, 2016 at 10:47 AM, Bin Meng <bmeng.cn@gmail.com> wrote: > On Wed, Jun 8, 2016 at 2:40 AM, George McCollister > <george.mccollister@gmail.com> wrote: >> An accumulated length was incorrectly added to current each pass >> through the loop. On system with more than 2 cores this caused a >> corrupt MADT to be generated. >> >> Signed-off-by: George McCollister <george.mccollister@gmail.com> >> --- >> arch/x86/lib/acpi_table.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> applied to u-boot-x86, thanks!
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index ffb4678..bb71286 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -183,20 +183,20 @@ static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic, int acpi_create_madt_lapics(u32 current) { struct udevice *dev; - int length = 0; + int total_length = 0; for (uclass_find_first_device(UCLASS_CPU, &dev); dev; uclass_find_next_device(&dev)) { struct cpu_platdata *plat = dev_get_parent_platdata(dev); - - length += acpi_create_madt_lapic( - (struct acpi_madt_lapic *)current, - plat->cpu_id, plat->cpu_id); + int length = acpi_create_madt_lapic( + (struct acpi_madt_lapic *)current, + plat->cpu_id, plat->cpu_id); current += length; + total_length += length; } - return length; + return total_length; } int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
An accumulated length was incorrectly added to current each pass through the loop. On system with more than 2 cores this caused a corrupt MADT to be generated. Signed-off-by: George McCollister <george.mccollister@gmail.com> --- arch/x86/lib/acpi_table.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)