]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg Variable: Keep the behavior of Variable Dxe and SMM drivers consistent
authorStar Zeng <star.zeng@intel.com>
Mon, 9 Mar 2015 13:05:55 +0000 (13:05 +0000)
committerlzeng14 <lzeng14@Edk2>
Mon, 9 Mar 2015 13:05:55 +0000 (13:05 +0000)
to return EFI_NOT_FOUND when a specified variable doesn't exist and
Data parameter is NULL but DataSize parameter is valid in GetVariable() invocation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17031 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmmRuntimeDxe.c

index 3e2ed08972c8c996f6be9d780e2c3587461077a4..be5c935a885567ba7016e0b9dc251f21d0e49787 100644 (file)
@@ -473,10 +473,6 @@ RuntimeServiceGetVariable (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if ((*DataSize != 0) && (Data == NULL)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
   TempDataSize          = *DataSize;\r
   VariableNameSize      = StrSize (VariableName);\r
   SmmVariableHeader     = NULL;\r
@@ -541,7 +537,11 @@ RuntimeServiceGetVariable (
     goto Done;\r
   }\r
 \r
-  CopyMem (Data, (UINT8 *)SmmVariableHeader->Name + SmmVariableHeader->NameSize, SmmVariableHeader->DataSize);\r
+  if (Data != NULL) {\r
+    CopyMem (Data, (UINT8 *)SmmVariableHeader->Name + SmmVariableHeader->NameSize, SmmVariableHeader->DataSize);\r
+  } else {\r
+    Status = EFI_INVALID_PARAMETER;\r
+  }\r
 \r
 Done:\r
   ReleaseLockOnlyAtBootTime (&mVariableServicesLock);\r