diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c b/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c index 7df5b9745f..ef3016db83 100644 --- a/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c +++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c @@ -745,7 +745,7 @@ GetNextDifferentElementInSortedArray ( UINT64 CurrentElement; CurrentElement = Array[Index]; - while (CurrentElement == Array[Index] && Index < Count) { + while ((Index < Count) && (CurrentElement == Array[Index])) { Index++; }