Refine code to make code run safely.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10880 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10
2010-09-16 04:51:25 +00:00
parent 7bee5a761f
commit cd7bfc2c63
12 changed files with 29 additions and 26 deletions

View File

@@ -467,7 +467,7 @@ DhcpCopyConfigure (
{
EFI_DHCP4_PACKET_OPTION **DstOptions;
EFI_DHCP4_PACKET_OPTION **SrcOptions;
INTN Len;
UINTN Len;
UINT32 Index;
CopyMem (Dst, Src, sizeof (*Dst));

View File

@@ -611,7 +611,7 @@ DhcpParseOption (
// Allocate a buffer to hold the DHCP options, and after that, a
// continuous buffer to put all the options' data.
//
Options = AllocateZeroPool (OptNum * sizeof (DHCP_OPTION) + TotalLen);
Options = AllocateZeroPool ((UINTN) (OptNum * sizeof (DHCP_OPTION)) + TotalLen);
if (Options == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -754,7 +754,7 @@ DhcpAppendOption (
*(Buf++) = Tag;
*(Buf++) = (UINT8) Len;
CopyMem (Buf, Data + Index * 255, Len);
CopyMem (Buf, Data + Index * 255, (UINTN) Len);
Buf += Len;
}

View File

@@ -223,7 +223,7 @@ Mtftp4RemoveBlockNum (
*TotalBlock = Num;
if (Range->Round > 0) {
*TotalBlock += Range->Bound + MultU64x32 (Range->Round -1, (UINT32)(Range->Bound + 1)) + 1;
*TotalBlock += Range->Bound + MultU64x32 ((UINTN) (Range->Round -1), (UINT32) (Range->Bound + 1)) + 1;
}
if (Range->Start > Range->Bound) {

View File

@@ -90,7 +90,7 @@ PxeFillHeader (
Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;
Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;
Snp->Cdb.CPBsize = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);
Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;