]> git.proxmox.com Git - mirror_edk2.git/commitdiff
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 208c05a0157b3305d9f59c32dea9f11472aaea1d..0735bf00b9bb5e041b028a9836c6d5c56b6d0b80 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 (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
       CopyMem (&gMemoryTypeInformation, EfiMemoryTypeInformation, DataSize);\r
     }\r
   }\r