Fix the bug that could make gMemoryTypeInformation unavailable when gMemoryTypeInform...
authorxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Dec 2006 02:06:19 +0000 (02:06 +0000)
committerxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Dec 2006 02:06:19 +0000 (02:06 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2080 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Core/Dxe/Gcd/gcd.c

index 208c05a..0735bf0 100644 (file)
@@ -2089,7 +2089,7 @@ Returns:
   if (GuidHob != NULL) {\r
     EfiMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob);\r
     DataSize                 = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
-    if (EfiMemoryTypeInformation != NULL && DataSize > 0 && DataSize < EfiMaxMemoryType * sizeof (EFI_MEMORY_TYPE_INFORMATION)) {\r
+    if (EfiMemoryTypeInformation != NULL && DataSize > 0 && DataSize <= (EfiMaxMemoryType + 1) * sizeof (EFI_MEMORY_TYPE_INFORMATION)) {\r
       CopyMem (&gMemoryTypeInformation, EfiMemoryTypeInformation, DataSize);\r
     }\r
   }\r