diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-25 10:13:26 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-25 10:13:26 +0000 |
commit | a3657e3e7aaaccb1b9ea1b41a72d4564452e272d (patch) | |
tree | 24272aceeed6a863f6c18f331386042770d51bcb /MdePkg/Library/DxeMemoryAllocationLib | |
parent | d05003bed6b96ad51fbf5d9b7b6c2897e6228245 (diff) | |
download | edk2-platforms-a3657e3e7aaaccb1b9ea1b41a72d4564452e272d.tar.xz |
MemoryAllocationLib: For boundary case: “AllocationSize + OverAllocationSize >= 4G”
DxeMemoryAllocationLib: Change the behavior from returning NULL to ASSERT ()
PeiMemoryAllocationLib: Add ASSERT ()
I also add ASSERT () in Pei Service AllocatePool () to catch if allocation size > 64K
DebugLib:
Header file (DebugLib.h): Fix an issue in ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid).
In contrast with LocateProtocol (), the first & second parameter type of HandleProtocol () is EFI_HANDLE & EFI_GUID respectively.
UefiLib:
For UnicodeStringDisplayLength (CONST CHAR8 *String), return 0 if String is NULL.
BasePrintLib:
Add missing “EFIAPI” to UnicodeValueToString() and AsciiValueToString() and move their definitions from PrintLibInternal.c to PrintLib.c.
Fix the comments error(Maximum Length TIME”)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@275 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/DxeMemoryAllocationLib')
-rw-r--r-- | MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c index ef643eed42..088a10bb56 100644 --- a/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c +++ b/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c @@ -168,13 +168,11 @@ InternalAllocateAlignedPages ( //
AlignmentMask = Alignment - 1;
RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
- if (RealPages <= Pages) {
- //
- // This extra checking is to make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
- //
- return NULL;
- }
-
+ //
+ // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
+ //
+ ASSERT (RealPages > Pages);
+
Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
@@ -601,12 +599,11 @@ InternalAllocateAlignedPool ( //
OverAllocationSize = sizeof (RawAddress) + AlignmentMask;
RealAllocationSize = AllocationSize + OverAllocationSize;
- if (RealAllocationSize <= AllocationSize ) {
- //
- // This extra checking is to make sure that AllocationSize plus OverAllocationSize does not overflow.
- //
- return NULL;
- }
+ //
+ // Make sure that AllocationSize plus OverAllocationSize does not overflow.
+ //
+ ASSERT (RealAllocationSize > AllocationSize);
+
RawAddress = InternalAllocatePool (PoolType, RealAllocationSize);
if (RawAddress == NULL) {
return NULL;
|