mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
dde4aedc35
commit
e19eab6153
|
@ -3,7 +3,7 @@
|
|||
Emulation Variable services operate on the runtime volatile memory.
|
||||
The nonvolatile variable space doesn't exist.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1183,6 +1183,10 @@ EmuGetVariable (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (VariableName[0] == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
|
||||
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Implement ReadOnly Variable Services required by PEIM and install
|
||||
PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -978,6 +978,10 @@ PeiGetVariable (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (VariableName[0] == 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
VariableHeader = NULL;
|
||||
|
||||
//
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue