Fix the bug that could make gMemoryTypeInformation unavailable when gMemoryTypeInformation is filled to EfiMaxMemoryType.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2080 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xgu3 2006-12-11 02:06:19 +00:00
parent c340a28e27
commit 4629ca40b7
1 changed files with 1 additions and 1 deletions

View File

@ -2089,7 +2089,7 @@ Returns:
if (GuidHob != NULL) { if (GuidHob != NULL) {
EfiMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob); EfiMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob);
DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob); DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
if (EfiMemoryTypeInformation != NULL && DataSize > 0 && DataSize < EfiMaxMemoryType * sizeof (EFI_MEMORY_TYPE_INFORMATION)) { if (EfiMemoryTypeInformation != NULL && DataSize > 0 && DataSize <= (EfiMaxMemoryType + 1) * sizeof (EFI_MEMORY_TYPE_INFORMATION)) {
CopyMem (&gMemoryTypeInformation, EfiMemoryTypeInformation, DataSize); CopyMem (&gMemoryTypeInformation, EfiMemoryTypeInformation, DataSize);
} }
} }