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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user