From 4629ca40b7d22356337ba5811e9220f0dd1e14ce Mon Sep 17 00:00:00 2001 From: xgu3 Date: Mon, 11 Dec 2006 02:06:19 +0000 Subject: [PATCH] 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 --- EdkModulePkg/Core/Dxe/Gcd/gcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } }