Re: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable
Reviewed-by: Nate DeSimone -Original Message- From: devel@edk2.groups.io On Behalf Of Zhang, Shenglei Sent: Wednesday, September 11, 2019 8:27 PM To: devel@edk2.groups.io Cc: Kubacki, Michael A ; Chiu, Chasel ; Desimone, Nathaniel L ; Gao, Liming Subject: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable Change ASSERT_EFI_ERROR to return value when the "if" statement is true. As a result, when SortCpuLocalApicInTable is called, error handling is needed. So add "if" statement to judge the returned Status from SortCpuLocalApicInTable () in function InstallMadtFromScratch(). Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Shenglei Zhang --- .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c index 2cc55ee8..ae25d753 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c @@ -354,7 +354,7 @@ SortCpuLocalApicInTable ( if(MAX_CPU_NUM <= Index) { DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable Index Bufferflow\n")); -ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER); +return EFI_INVALID_PARAMETER; } TempVal = mCpuApicIdOrderTable[Index].ApicId; @@ -874,7 +874,11 @@ InstallMadtFromScratch ( DetectApicIdMap(); // Call for Local APIC ID Reorder - SortCpuLocalApicInTable (); + Status = SortCpuLocalApicInTable (); + if (EFI_ERROR (Status)) { +DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n", Status)); +goto Done; + } MaxMadtStructCount = (UINT32) ( MAX_CPU_NUM +// processor local APIC structures -- 2.18.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47196): https://edk2.groups.io/g/devel/message/47196 Mute This Topic: https://groups.io/mt/34111553/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable
Reviewed-by: Michael Kubacki > -Original Message- > From: devel@edk2.groups.io On Behalf Of Zhang, > Shenglei > Sent: Wednesday, September 11, 2019 8:27 PM > To: devel@edk2.groups.io > Cc: Kubacki, Michael A ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Gao, Liming > Subject: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error > handling to SortCpuLocalApicInTable > > Change ASSERT_EFI_ERROR to return value when the "if" statement is true. > As a result, when SortCpuLocalApicInTable is called, error handling is needed. > So add "if" statement to judge the returned Status from > SortCpuLocalApicInTable () in function InstallMadtFromScratch(). > > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Signed-off-by: Shenglei Zhang > --- > .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > index 2cc55ee8..ae25d753 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > @@ -354,7 +354,7 @@ SortCpuLocalApicInTable ( > >if(MAX_CPU_NUM <= Index) { > DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable Index > Bufferflow\n")); > -ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER); > +return EFI_INVALID_PARAMETER; >} > >TempVal = mCpuApicIdOrderTable[Index].ApicId; > @@ -874,7 +874,11 @@ InstallMadtFromScratch ( >DetectApicIdMap(); > >// Call for Local APIC ID Reorder > - SortCpuLocalApicInTable (); > + Status = SortCpuLocalApicInTable (); > + if (EFI_ERROR (Status)) { > +DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n", Status)); > +goto Done; > + } > >MaxMadtStructCount = (UINT32) ( > MAX_CPU_NUM +// processor local APIC structures > -- > 2.18.0.windows.1 > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47175): https://edk2.groups.io/g/devel/message/47175 Mute This Topic: https://groups.io/mt/34111553/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable
Reviewed-by: Chasel Chiu > -Original Message- > From: Zhang, Shenglei > Sent: Thursday, September 12, 2019 11:27 AM > To: devel@edk2.groups.io > Cc: Kubacki, Michael A ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Gao, Liming > Subject: [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to > SortCpuLocalApicInTable > > Change ASSERT_EFI_ERROR to return value when the "if" statement is true. > As a result, when SortCpuLocalApicInTable is called, error handling is > needed. So add "if" statement to judge the returned Status from > SortCpuLocalApicInTable () in function InstallMadtFromScratch(). > > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Signed-off-by: Shenglei Zhang > --- > .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > index 2cc55ee8..ae25d753 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > @@ -354,7 +354,7 @@ SortCpuLocalApicInTable ( > >if(MAX_CPU_NUM <= Index) { > DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable > Index Bufferflow\n")); > -ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER); > +return EFI_INVALID_PARAMETER; >} > >TempVal = mCpuApicIdOrderTable[Index].ApicId; > @@ -874,7 +874,11 @@ InstallMadtFromScratch ( >DetectApicIdMap(); > >// Call for Local APIC ID Reorder > - SortCpuLocalApicInTable (); > + Status = SortCpuLocalApicInTable (); > + if (EFI_ERROR (Status)) { > +DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n", > Status)); > +goto Done; > + } > >MaxMadtStructCount = (UINT32) ( > MAX_CPU_NUM +// processor local APIC structures > -- > 2.18.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47166): https://edk2.groups.io/g/devel/message/47166 Mute This Topic: https://groups.io/mt/34111553/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-