X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FLibrary%2FLegacyBootMaintUiLib%2FLegacyBootMaintUi.c;fp=IntelFrameworkModulePkg%2FLibrary%2FLegacyBootMaintUiLib%2FLegacyBootMaintUi.c;h=4ebba337deddc537351d8d25e61d6bf4508e0e40;hb=fa6c39dbfb896f2bd32942d6bcd998725a4516c7;hp=6a768424884aa4a18e3076d12c748d0bd0d67406;hpb=d91cb87049db11a193bacec72506a24df19e46e9;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c index 6a76842488..4ebba337de 100644 --- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c +++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c @@ -144,6 +144,8 @@ OrderLegacyBootOption4SameType ( *EnBootOptionCount = 0; Index = 0; + ASSERT (BbsIndexArray != NULL); + ASSERT (DeviceTypeArray != NULL); ASSERT (*EnBootOption != NULL); ASSERT (*DisBootOption != NULL); @@ -175,6 +177,7 @@ OrderLegacyBootOption4SameType ( // StartPosition = BootOrderSize / sizeof (UINT16); NewBootOption = AllocatePool (DevOrderCount * sizeof (UINT16)); + ASSERT (NewBootOption != NULL); while (DevOrderCount-- != 0) { for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) { if (BbsIndexArray[Index] == (DevOrder[DevOrderCount] & 0xFF)) { @@ -1178,6 +1181,7 @@ GetLegacyOptionsOrder ( UINTN Pos; UINTN Bit; UINT8 *DisMap; + UINTN TotalLength; LegacyDev = NULL; OptionMenu = NULL; @@ -1228,9 +1232,10 @@ GetLegacyOptionsOrder ( // // Create oneof tag here for FD/HD/CD #1 #2 // - for (Index = 0; Index < OptionMenu->MenuNumber; Index++) { - VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16)); - + for (Index = 0; Index < OptionMenu->MenuNumber; Index++) { + TotalLength = sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16); + VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + TotalLength); + if (0xFF00 == (VarDevOrder & 0xFF00)) { LegacyDev[Index] = 0xFF; Pos = (VarDevOrder & 0xFF) / 8; @@ -1241,7 +1246,7 @@ GetLegacyOptionsOrder ( } } - VarData += sizeof (BBS_TYPE); + VarData ++; VarData += *(UINT16 *) VarData; DevOrder = (LEGACY_DEV_ORDER_ENTRY *) VarData; }