summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Variable/RuntimeDxe
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-05-13 13:00:01 +0800
committerStar Zeng <star.zeng@intel.com>2016-05-15 17:48:53 +0800
commite19eab615305b1490b2dee0de0360736be10f9a7 (patch)
tree217f677739314a9dfae6ccf29c86c1700a6b9e3e /MdeModulePkg/Universal/Variable/RuntimeDxe
parentdde4aedc35ee3c06b67c1a5c4f392e7a0b0f8254 (diff)
downloadedk2-platforms-e19eab615305b1490b2dee0de0360736be10f9a7.tar.xz
MdeModulePkg Variable: return error for empty str VariableName to GetVariable
Current GetVariable implementation will return the first variable for empty str VariableName, it is because GetVariable and GetNextVariablename are sharing same function FindVariable. But UEFI sepc defines SetVariable that If VariableName is an empty string, then EFI_INVALID_PARAMETER is returned, that means an empty string variable could never be set successfully, so GetVariable should return error for empty string VariableName. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Variable/RuntimeDxe')
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 3f0240bc07..17475be323 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -2849,6 +2849,10 @@ VariableServiceGetVariable (
return EFI_INVALID_PARAMETER;
}
+ if (VariableName[0] == 0) {
+ return EFI_NOT_FOUND;
+ }
+
AcquireLockOnlyAtBootTime(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
Status = FindVariable (VariableName, VendorGuid, &Variable, &mVariableModuleGlobal->VariableGlobal, FALSE);