mirror of https://github.com/acidanthera/audk.git
Fix a bug in UefiDefaultsToFwDefaults NULL should be returned if no Variable pack is found.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5719 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4b79797eea
commit
1e22d0b02c
|
@ -652,6 +652,7 @@ UefiDefaultsToFwDefaults (
|
||||||
UINT16 DefaultId;
|
UINT16 DefaultId;
|
||||||
EFI_HII_VARIABLE_PACK *Pack;
|
EFI_HII_VARIABLE_PACK *Pack;
|
||||||
EFI_HII_VARIABLE_PACK_LIST *PackList;
|
EFI_HII_VARIABLE_PACK_LIST *PackList;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
if (DefaultMask == FRAMEWORK_EFI_IFR_FLAG_DEFAULT) {
|
if (DefaultMask == FRAMEWORK_EFI_IFR_FLAG_DEFAULT) {
|
||||||
DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
|
DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
|
||||||
|
@ -685,6 +686,11 @@ UefiDefaultsToFwDefaults (
|
||||||
List = GetNextNode (ListHead, List);
|
List = GetNextNode (ListHead, List);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Count == 0) {
|
||||||
|
*VariablePackList = NULL;
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
Size = Size + Count * (sizeof (EFI_HII_VARIABLE_PACK_LIST) + sizeof (EFI_HII_VARIABLE_PACK));
|
Size = Size + Count * (sizeof (EFI_HII_VARIABLE_PACK_LIST) + sizeof (EFI_HII_VARIABLE_PACK));
|
||||||
|
|
||||||
*VariablePackList = AllocateZeroPool (Size);
|
*VariablePackList = AllocateZeroPool (Size);
|
||||||
|
@ -694,6 +700,7 @@ UefiDefaultsToFwDefaults (
|
||||||
|
|
||||||
PackList = (EFI_HII_VARIABLE_PACK_LIST *) *VariablePackList;
|
PackList = (EFI_HII_VARIABLE_PACK_LIST *) *VariablePackList;
|
||||||
Pack = (EFI_HII_VARIABLE_PACK *) (PackList + 1);
|
Pack = (EFI_HII_VARIABLE_PACK *) (PackList + 1);
|
||||||
|
Index = 0;
|
||||||
while (!IsNull (ListHead, List)) {
|
while (!IsNull (ListHead, List)) {
|
||||||
Node = UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(List);
|
Node = UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(List);
|
||||||
|
|
||||||
|
@ -727,10 +734,13 @@ UefiDefaultsToFwDefaults (
|
||||||
Size += sizeof (EFI_HII_VARIABLE_PACK_LIST);
|
Size += sizeof (EFI_HII_VARIABLE_PACK_LIST);
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize EFI_HII_VARIABLE_PACK_LIST
|
// Initialize EFI_HII_VARIABLE_PACK_LIST
|
||||||
//
|
//
|
||||||
PackList->VariablePack = Pack;
|
PackList->VariablePack = Pack;
|
||||||
|
Index++;
|
||||||
|
if (Index < Count) {
|
||||||
PackList->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *)((UINT8 *) PackList + Size);
|
PackList->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *)((UINT8 *) PackList + Size);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue