PeiSmbusLib & DxeSmbusLib

Remove Arp Related interfaces
	Change the return type of SmbusQuickWrite from “BOOLEAN” to “VOID”
	Complete interface SmBusBlockProcessCall()
	Make the PEC bit “bit 21” of SMBUS address. If data show that MSB helps to save code size in BaseSmbusLib, we may simply redefine it to be MAX_BIT.
UefiLib
	Modify the interfaces in UefiNotTiano.c to sync with spec
MemoryAllocationLib
	Add extra checking in “Aligned” Memory services to prevent “AllocationSize + OverAllocation” overflow in DxeMemoryAllocationLib.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@23 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2006-04-25 05:51:23 +00:00
parent ee19dec64f
commit abea19dbe1
10 changed files with 86 additions and 669 deletions

View File

@ -168,6 +168,13 @@ 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;
}
Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);
if (EFI_ERROR (Status)) {
return NULL;
@ -576,8 +583,8 @@ InternalAllocateAlignedPool (
UINTN AlignedAddress;
UINTN AlignmentMask;
UINTN OverAllocationSize;
UINTN RealAllocationSize;
VOID **FreePointer;
EFI_STATUS Status;
//
// Alignment must be a power of two or zero.
@ -593,8 +600,15 @@ InternalAllocateAlignedPool (
// Calculate the extra memory size, over-allocate memory pool and get the aligned memory address.
//
OverAllocationSize = sizeof (RawAddress) + AlignmentMask;
Status = gBS->AllocatePool (PoolType, AllocationSize + OverAllocationSize, &RawAddress);
if (EFI_ERROR (Status)) {
RealAllocationSize = AllocationSize + OverAllocationSize;
if (RealAllocationSize <= AllocationSize ) {
//
// This extra checking is to make sure that AllocationSize plus OverAllocationSize does not overflow.
//
return NULL;
}
RawAddress = InternalAllocatePool (PoolType, RealAllocationSize);
if (RawAddress == NULL) {
return NULL;
}
AlignedAddress = ((UINTN) RawAddress + OverAllocationSize) & ~AlignmentMask;