From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: shenglei.zhang@intel.com) Received: from mga17.intel.com (mga17.intel.com []) by groups.io with SMTP; Mon, 02 Sep 2019 05:30:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Sep 2019 05:30:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,459,1559545200"; d="scan'208";a="186989613" Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2019 05:30:23 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [PATCH 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable Date: Mon, 2 Sep 2019 20:30:17 +0800 Message-Id: <20190902123017.26220-3-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20190902123017.26220-1-shenglei.zhang@intel.com> References: <20190902123017.26220-1-shenglei.zhang@intel.com> 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 85d1bd9a..dc68dfaa 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