Refine some code to make the code run safely.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10863 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -49,8 +49,8 @@ InternalMathDivRemS64x64 (
|
||||
INT64 Quot;
|
||||
|
||||
Quot = InternalMathDivRemU64x64 (
|
||||
Dividend >= 0 ? Dividend : -Dividend,
|
||||
Divisor >= 0 ? Divisor : -Divisor,
|
||||
(UINT64) (Dividend >= 0 ? Dividend : -Dividend),
|
||||
(UINT64) (Divisor >= 0 ? Divisor : -Divisor),
|
||||
(UINT64 *) Remainder
|
||||
);
|
||||
if (Remainder != NULL && Dividend < 0) {
|
||||
|
@@ -45,5 +45,5 @@ MultS64x64 (
|
||||
IN INT64 Multiplier
|
||||
)
|
||||
{
|
||||
return (INT64)MultU64x64 (Multiplicand, Multiplier);
|
||||
return (INT64)MultU64x64 ((UINT64) Multiplicand, (UINT64) Multiplier);
|
||||
}
|
||||
|
@@ -353,7 +353,7 @@ InterlockedCompareExchangePointer (
|
||||
{
|
||||
UINT8 SizeOfValue;
|
||||
|
||||
SizeOfValue = sizeof (*Value);
|
||||
SizeOfValue = (UINT8) sizeof (*Value);
|
||||
|
||||
switch (SizeOfValue) {
|
||||
case sizeof (UINT32):
|
||||
|
@@ -512,7 +512,7 @@ GlueReportStatusCodeEx (
|
||||
//
|
||||
// Fill in the extended data header
|
||||
//
|
||||
StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
|
||||
StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
|
||||
StatusCodeData->Size = (UINT16)ExtendedDataSize;
|
||||
if (ExtendedDataGuid == NULL) {
|
||||
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;
|
||||
|
@@ -254,7 +254,7 @@ GlueBuildModuleHob (
|
||||
{
|
||||
EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
|
||||
|
||||
CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
|
||||
Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
|
||||
@@ -295,7 +295,7 @@ BuildResourceDescriptorHob (
|
||||
{
|
||||
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
|
||||
|
||||
Hob->ResourceType = ResourceType;
|
||||
Hob->ResourceAttribute = ResourceAttribute;
|
||||
@@ -402,7 +402,7 @@ BuildFvHob (
|
||||
// Check FV Signature
|
||||
//
|
||||
ASSERT (((EFI_FIRMWARE_VOLUME_HEADER*)((UINTN)BaseAddress))->Signature == EFI_FVH_SIGNATURE);
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
|
||||
|
||||
Hob->BaseAddress = BaseAddress;
|
||||
Hob->Length = Length;
|
||||
@@ -429,7 +429,7 @@ BuildCvHob (
|
||||
{
|
||||
EFI_HOB_CAPSULE_VOLUME *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CV, sizeof (EFI_HOB_CAPSULE_VOLUME));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CV, (UINT16) sizeof (EFI_HOB_CAPSULE_VOLUME));
|
||||
|
||||
Hob->BaseAddress = BaseAddress;
|
||||
Hob->Length = Length;
|
||||
@@ -456,7 +456,7 @@ BuildCpuHob (
|
||||
{
|
||||
EFI_HOB_CPU *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));
|
||||
|
||||
Hob->SizeOfMemorySpace = SizeOfMemorySpace;
|
||||
Hob->SizeOfIoSpace = SizeOfIoSpace;
|
||||
@@ -488,7 +488,7 @@ BuildStackHob (
|
||||
{
|
||||
EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
|
||||
|
||||
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
|
||||
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
|
||||
@@ -524,7 +524,7 @@ BuildBspStoreHob (
|
||||
{
|
||||
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
|
||||
|
||||
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);
|
||||
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
|
||||
@@ -560,7 +560,7 @@ GlueBuildMemoryAllocationHob (
|
||||
{
|
||||
EFI_HOB_MEMORY_ALLOCATION *Hob;
|
||||
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));
|
||||
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));
|
||||
|
||||
ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
|
||||
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
|
||||
|
@@ -447,7 +447,7 @@ GlueReportStatusCodeEx (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;
|
||||
StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
|
||||
StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
|
||||
StatusCodeData->Size = (UINT16)ExtendedDataSize;
|
||||
if (ExtendedDataGuid == NULL) {
|
||||
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;
|
||||
|
@@ -319,7 +319,7 @@ InternalReportStatusCodeEx (
|
||||
//
|
||||
// Fill in the extended data header
|
||||
//
|
||||
mStatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
|
||||
mStatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
|
||||
mStatusCodeData->Size = (UINT16)ExtendedDataSize;
|
||||
if (ExtendedDataGuid == NULL) {
|
||||
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;
|
||||
|
Reference in New Issue
Block a user