summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2015-03-09 13:03:42 +0000
committerlzeng14 <lzeng14@Edk2>2015-03-09 13:03:42 +0000
commit82e47eb22f1873835ef38e2941e266adfe1ff836 (patch)
tree526a0e18530483c10c301df84e09c87dc28bb9d6
parent33f413f0d6d7620843717bbe1f22bf8d054a478f (diff)
downloadedk2-82e47eb22f1873835ef38e2941e266adfe1ff836.tar.gz
edk2-82e47eb22f1873835ef38e2941e266adfe1ff836.tar.bz2
edk2-82e47eb22f1873835ef38e2941e266adfe1ff836.zip
MdeModulePkg Variable: Keep the behavior of Variable Dxe and SMM drivers consistent
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@17030 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
index 873930ce67..3a87298160 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
@@ -459,10 +459,6 @@ RuntimeServiceGetVariable (
return EFI_INVALID_PARAMETER;
}
- if ((*DataSize != 0) && (Data == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
TempDataSize = *DataSize;
VariableNameSize = StrSize (VariableName);
SmmVariableHeader = NULL;
@@ -527,7 +523,11 @@ RuntimeServiceGetVariable (
goto Done;
}
- CopyMem (Data, (UINT8 *)SmmVariableHeader->Name + SmmVariableHeader->NameSize, SmmVariableHeader->DataSize);
+ if (Data != NULL) {
+ CopyMem (Data, (UINT8 *)SmmVariableHeader->Name + SmmVariableHeader->NameSize, SmmVariableHeader->DataSize);
+ } else {
+ Status = EFI_INVALID_PARAMETER;
+ }
Done:
ReleaseLockOnlyAtBootTime (&mVariableServicesLock);