]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change BufferSize from UINTN * to UINTN to eliminate pointer to pointer in SmmCore...
authorjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 21 Mar 2010 04:17:16 +0000 (04:17 +0000)
committerjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 21 Mar 2010 04:17:16 +0000 (04:17 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10299 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c

index e49661a00600c4d81103a52fe5ef4f29524134ad..b391ecf61f27d29e3e3c111196687fc550751a42 100644 (file)
@@ -276,19 +276,19 @@ SmmEntryPoint (
     // Synchronous SMI for SMM Core or request from Communicate protocol\r
     //\r
     CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)gSmmCorePrivate->CommunicationBuffer;\r
-    *gSmmCorePrivate->BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+    gSmmCorePrivate->BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
     Status = SmiManage (\r
                &CommunicateHeader->HeaderGuid, \r
                NULL, \r
                CommunicateHeader->Data, \r
-               gSmmCorePrivate->BufferSize\r
+               &gSmmCorePrivate->BufferSize\r
                );\r
 \r
     //\r
     // Update CommunicationBuffer, BufferSize and ReturnStatus\r
     // Communicate service finished, reset the pointer to CommBuffer to NULL\r
     //\r
-    *gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+    gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
     gSmmCorePrivate->CommunicationBuffer = NULL;\r
     gSmmCorePrivate->ReturnStatus = (Status == EFI_WARN_INTERRUPT_SOURCE_QUIESCED) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
   } else {\r
index ce007015a1ed8053517d686c016075f5169f51e5..b8bc75882488c15c7e5cb351db699b3af723e4eb 100644 (file)
@@ -93,7 +93,7 @@ typedef struct {
   /// in bytes, into a software SMI handler and for the software SMI handler to pass the \r
   /// size, in bytes, of a buffer back to the caller of the SMM Communication Protocol.\r
   ///\r
-  UINTN                           *BufferSize;\r
+  UINTN                           BufferSize;\r
 \r
   ///\r
   /// This field is used by the SMM Communication Protocol to pass the return status from\r
index 608fedfcbe5a5e459a1e3bc4a668d67af8d5ae9d..6b89ab3aa3210f2e3b14d6166d0a3cbcdea94d14 100644 (file)
@@ -210,8 +210,8 @@ SMM_CORE_PRIVATE_DATA  mSmmCorePrivateData = {
   FALSE,                              // SmmEntryPointRegistered\r
   FALSE,                              // InSmm\r
   NULL,                               // Smst\r
-  0,                                  // BufferSize\r
   NULL,                               // CommunicationBuffer\r
+  0,                                  // BufferSize\r
   EFI_SUCCESS                         // ReturnStatus\r
 };\r
 \r
@@ -410,6 +410,13 @@ SmmCommunicationCommunicate (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  //\r
+  // CommSize must hold HeaderGuid and MessageLength\r
+  //\r
+  if (*CommSize < OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   //\r
   // If not already in SMM, then generate a Software SMI\r
   //\r
@@ -418,7 +425,7 @@ SmmCommunicationCommunicate (
     // Put arguments for Software SMI in gSmmCorePrivate\r
     //\r
     gSmmCorePrivate->CommunicationBuffer = CommBuffer;\r
-    gSmmCorePrivate->BufferSize          = CommSize;\r
+    gSmmCorePrivate->BufferSize          = *CommSize;\r
 \r
     //\r
     // Generate Software SMI\r
@@ -431,6 +438,7 @@ SmmCommunicationCommunicate (
     //\r
     // Return status from software SMI \r
     //\r
+    *CommSize = gSmmCorePrivate->BufferSize;\r
     return gSmmCorePrivate->ReturnStatus;\r
   }\r
 \r