Skip to content

Commit

Permalink
Changed how GUIDs were compared in Ppi.c
Browse files Browse the repository at this point in the history
  • Loading branch information
kenlautner committed Jul 12, 2023
1 parent f1bcc2b commit 9551275
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions MdeModulePkg/Core/Pei/Ppi/Ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ConvertPpiPointersFv (
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
UINT8 GuidIndex;
EFI_GUID *Guid;
EFI_GUID (*GuidCheckList)[2];
EFI_GUID *GuidCheckList[2];

GuidCheckList[0] = &gEfiPeiFirmwareVolumeInfoPpiGuid;
GuidCheckList[1] = &gEfiPeiFirmwareVolumeInfo2PpiGuid;
Expand Down Expand Up @@ -324,16 +324,8 @@ ConvertPpiPointersFv (

Guid = PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Guid;
for (GuidIndex = 0; GuidIndex < ARRAY_SIZE (GuidCheckList); ++GuidIndex) {
//
// Don't use CompareGuid function here for performance reasons.
// Instead we compare the GUID as INT32 at a time and branch
// on the first failed comparison.
//
// MU_CHANGE [BEGIN] - CodeQL change
if ((((INT32 *)Guid)[0] == ((INT32 *)(GuidCheckList[GuidIndex]))[0]) &&
(((INT32 *)Guid)[1] == ((INT32 *)(GuidCheckList[GuidIndex]))[1]) &&
(((INT32 *)Guid)[2] == ((INT32 *)(GuidCheckList[GuidIndex]))[2]) &&
(((INT32 *)Guid)[3] == ((INT32 *)(GuidCheckList[GuidIndex]))[3]))
if (CompareMem (Guid, GuidCheckList[GuidIndex], 16) == 0)
// MU_CHANGE [END] - CodeQL change
{
FvInfoPpi = PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi->Ppi;
Expand Down

0 comments on commit 9551275

Please sign in to comment.