From: xgu3 Date: Mon, 11 Dec 2006 02:06:19 +0000 (+0000) Subject: Fix the bug that could make gMemoryTypeInformation unavailable when gMemoryTypeInform... X-Git-Tag: edk2-stable201903~23797 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4629ca40b7d22356337ba5811e9220f0dd1e14ce 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 --- diff --git a/EdkModulePkg/Core/Dxe/Gcd/gcd.c b/EdkModulePkg/Core/Dxe/Gcd/gcd.c index 208c05a015..0735bf00b9 100644 --- a/EdkModulePkg/Core/Dxe/Gcd/gcd.c +++ b/EdkModulePkg/Core/Dxe/Gcd/gcd.c @@ -2089,7 +2089,7 @@ Returns: if (GuidHob != NULL) { EfiMemoryTypeInformation = GET_GUID_HOB_DATA (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); } }