When the ExecuteSmmCoreFromSmram() function fails, SmmIplEntry() restores
the SMRAM range to EFI_MEMORY_UC. However, it saves the return value of
gDS->SetMemorySpaceAttributes() in the same Status variable that contains
the return value of ExecuteSmmCoreFromSmram(). Therefore, if
gDS->SetMemorySpaceAttributes() succeeds, the failure of
ExecuteSmmCoreFromSmram() is masked, and Bad Things Happen (TM).

Introduce a temporary variable just for the return value of
gDS->SetMemorySpaceAttributes().

Cc: Feng Tian <feng.t...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4759579..35da454 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -1213,12 +1213,14 @@ SmmIplEntry (
       // Attempt to reset SMRAM cacheability to UC
       //
       if (CpuArch != NULL) {
-        Status = gDS->SetMemorySpaceAttributes(
-                        mSmramCacheBase, 
-                        mSmramCacheSize,
-                        EFI_MEMORY_UC
-                        );
-        if (EFI_ERROR (Status)) {
+        EFI_STATUS SetAttrStatus;
+
+        SetAttrStatus = gDS->SetMemorySpaceAttributes(
+                               mSmramCacheBase,
+                               mSmramCacheSize,
+                               EFI_MEMORY_UC
+                               );
+        if (EFI_ERROR (SetAttrStatus)) {
           DEBUG ((DEBUG_WARN, "SMM IPL failed to reset SMRAM window to 
EFI_MEMORY_UC\n"));
         }  
       }
-- 
1.8.3.1



------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to