diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-03-04 11:33:13 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-03-04 11:33:13 +0000 |
commit | 383c303c497d5268f62790de46c5c82d20c65bd6 (patch) | |
tree | 3905de8cc5b176416bb610794c95ffe948e392a9 /MdeModulePkg/Core/Dxe | |
parent | 9521b669f88c01003b1ae3dc6824ccac3c7e70b6 (diff) | |
download | edk2-383c303c497d5268f62790de46c5c82d20c65bd6.zip edk2-383c303c497d5268f62790de46c5c82d20c65bd6.tar.gz edk2-383c303c497d5268f62790de46c5c82d20c65bd6.tar.bz2 |
Fix two minor defects:
1. CoreGetMemoryMap() returns unclean data
2. Zero length memory descriptor might be added to the memory map
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4790 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Gcd/gcd.c | 3 | ||||
-rw-r--r-- | MdeModulePkg/Core/Dxe/Mem/Page.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Gcd/gcd.c b/MdeModulePkg/Core/Dxe/Gcd/gcd.c index 1d02354..3cadab2 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/gcd.c @@ -2473,6 +2473,9 @@ Returns: if (MemorySpaceMap[Index].ImageHandle == NULL) {
BaseAddress = PageAlignAddress (MemorySpaceMap[Index].BaseAddress);
Length = PageAlignLength (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - BaseAddress);
+ if (Length == 0 || MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length < BaseAddress) {
+ continue;
+ }
CoreAddMemoryDescriptor (
EfiConventionalMemory,
BaseAddress,
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 0ac2aa5..97179de 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1432,7 +1432,7 @@ Returns: //
// Build the map
//
- ZeroMem (MemoryMap, Size);
+ ZeroMem (MemoryMap, BufferSize);
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
ASSERT (Entry->VirtualStart == 0);
|