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
This commit is contained in:
Star Zeng 2015-03-09 13:03:42 +00:00 committed by lzeng14
parent 33f413f0d6
commit 82e47eb22f
1 changed files with 5 additions and 5 deletions

View File

@ -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);