]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/SmramSaveInfoHandlerSmm/SmramSaveInfoHandlerSmm.c
Fixed potential security issue introduced by SmramCpuNvs variable.
[mirror_edk2.git] / Vlv2TbltDevicePkg / SmramSaveInfoHandlerSmm / SmramSaveInfoHandlerSmm.c
index a48de262dbcea028b049a64f88fef14757779276..790c10c32974603eec40b7505071eb865a8653ca 100644 (file)
@@ -3,7 +3,7 @@
 \r
   This driver is for ECP platforms.\r
 \r
-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
                                                                                    \r\r
   This program and the accompanying materials are licensed and made available under\r\r
   the terms and conditions of the BSD License that accompanies this distribution.  \r\r
@@ -27,6 +27,7 @@
 #include <Protocol/SmmSwDispatch.h>\r
 #include <Protocol/SmmReadyToLock.h>\r
 #include <Protocol/SmmControl.h>\r
+#include <Guid/Vlv2DeviceRefCodePkgTokenSpace.h>\r
 \r
 #define SMM_FROM_SMBASE_DRIVER        0x55\r
 #define SMM_FROM_CPU_DRIVER_SAVE_INFO 0x81\r
@@ -61,29 +62,15 @@ SmramSaveInfoHandler (
   IN  EFI_SMM_SW_DISPATCH_CONTEXT   *DispatchContext\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-  UINT64     VarData[3];\r
-  UINTN      VarSize;\r
-\r
   ASSERT (DispatchContext != NULL);\r
   ASSERT (DispatchContext->SwSmiInputValue == SMM_FROM_SMBASE_DRIVER);\r
 \r
   if (!mLocked && IoRead8 (mSmiDataRegister) == SMM_FROM_CPU_DRIVER_SAVE_INFO) {\r
-    VarSize = sizeof (VarData);\r
-    Status = gRT->GetVariable (\r
-                    L"SmramCpuNvs",\r
-                    &mSmramCpuNvsHeaderGuid,\r
-                    NULL,\r
-                    &VarSize,\r
-                    VarData\r
-                    );\r
-    if (!EFI_ERROR (Status) && VarSize == sizeof (VarData)) {\r
       CopyMem (\r
-        (VOID *)(UINTN)(VarData[0]),\r
-        (VOID *)(UINTN)(VarData[1]),\r
-        (UINTN)(VarData[2])\r
+        (VOID *)(UINTN)(PcdGetEx64 (&gEfiVLVTokenSpaceGuid, PcdCpuLockBoxDataAddress)),\r
+        (VOID *)(UINTN)(PcdGetEx64 (&gEfiVLVTokenSpaceGuid, PcdCpuSmramCpuDataAddress)),\r
+        (UINTN)(PcdGetEx64 (&gEfiVLVTokenSpaceGuid, PcdCpuLockBoxSize))\r
         );\r
-    }\r
   }\r
 }\r
 \r