summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/UefiPxeBcDxe
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-09-15 07:48:11 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-09-15 07:48:11 +0000
commitc9325700d0ef25eaf45077928af3f93b15ac5fe0 (patch)
treec46ae68c26db3a5a6a9e58b37b53265aa2f770d3 /MdeModulePkg/Universal/Network/UefiPxeBcDxe
parentf6b4e53dfe43c27d448cedb57059e5b7ca236dd8 (diff)
downloadedk2-c9325700d0ef25eaf45077928af3f93b15ac5fe0.zip
edk2-c9325700d0ef25eaf45077928af3f93b15ac5fe0.tar.gz
edk2-c9325700d0ef25eaf45077928af3f93b15ac5fe0.tar.bz2
Refine soma code to make code run safely.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10877 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/UefiPxeBcDxe')
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c18
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c4
2 files changed, 11 insertions, 11 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index ce58321..6b25cab 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -852,7 +852,7 @@ PxeBcDhcpCallBack (
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));
}
- DhcpHeader->HwAddrLen = sizeof (EFI_GUID);
+ DhcpHeader->HwAddrLen = (UINT8) sizeof (EFI_GUID);
}
if (Dhcp4Event == Dhcp4SendDiscover) {
@@ -948,7 +948,7 @@ PxeBcBuildDhcpOptions (
// Append max message size.
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_MAXMSG;
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE);
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE);
OptEnt.MaxMesgSize = (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE *) OptList[Index]->Data;
Value = NTOHS (PXEBC_DHCP4_MAX_PACKET_SIZE);
CopyMem (&OptEnt.MaxMesgSize->Size, &Value, sizeof (UINT16));
@@ -1003,7 +1003,7 @@ PxeBcBuildDhcpOptions (
// Append UUID/Guid-based client identifier option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UUID;
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UUID);
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UUID);
OptEnt.Uuid = (PXEBC_DHCP4_OPTION_UUID *) OptList[Index]->Data;
OptEnt.Uuid->Type = 0;
Index++;
@@ -1022,7 +1022,7 @@ PxeBcBuildDhcpOptions (
// Append client network device interface option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UNDI;
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UNDI);
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UNDI);
OptEnt.Undi = (PXEBC_DHCP4_OPTION_UNDI *) OptList[Index]->Data;
if (Private->Nii != NULL) {
OptEnt.Undi->Type = Private->Nii->Type;
@@ -1041,7 +1041,7 @@ PxeBcBuildDhcpOptions (
// Append client system architecture option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_ARCH;
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_ARCH);
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_ARCH);
OptEnt.Arch = (PXEBC_DHCP4_OPTION_ARCH *) OptList[Index]->Data;
Value = HTONS (EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE);
CopyMem (&OptEnt.Arch->Type, &Value, sizeof (UINT16));
@@ -1052,7 +1052,7 @@ PxeBcBuildDhcpOptions (
// Append client system architecture option
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_CLASS_ID;
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_CLID);
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_CLID);
OptEnt.Clid = (PXEBC_DHCP4_OPTION_CLID *) OptList[Index]->Data;
CopyMem (OptEnt.Clid, DEFAULT_CLASS_ID_DATA, sizeof (PXEBC_DHCP4_OPTION_CLID));
CvtNum (EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE, OptEnt.Clid->ArchitectureType, sizeof (OptEnt.Clid->ArchitectureType));
@@ -1149,7 +1149,7 @@ PxeBcDiscvBootService (
//
// Add vendor option of PXE_BOOT_ITEM
//
- VendorOptLen = (sizeof (EFI_DHCP4_PACKET_OPTION) - 1) * 2 + sizeof (PXEBC_OPTION_BOOT_ITEM) + 1;
+ VendorOptLen = (UINT8) ((sizeof (EFI_DHCP4_PACKET_OPTION) - 1) * 2 + sizeof (PXEBC_OPTION_BOOT_ITEM) + 1);
OptList[OptCount] = AllocatePool (VendorOptLen);
if (OptList[OptCount] == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1159,7 +1159,7 @@ PxeBcDiscvBootService (
OptList[OptCount]->Length = (UINT8) (VendorOptLen - 2);
PxeOpt = (EFI_DHCP4_PACKET_OPTION *) OptList[OptCount]->Data;
PxeOpt->OpCode = PXEBC_VENDOR_TAG_BOOT_ITEM;
- PxeOpt->Length = sizeof (PXEBC_OPTION_BOOT_ITEM);
+ PxeOpt->Length = (UINT8) sizeof (PXEBC_OPTION_BOOT_ITEM);
PxeBootItem = (PXEBC_OPTION_BOOT_ITEM *) PxeOpt->Data;
PxeBootItem->Type = HTONS (Type);
PxeBootItem->Layer = HTONS (*Layer);
@@ -1187,7 +1187,7 @@ PxeBcDiscvBootService (
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));
}
- DhcpHeader->HwAddrLen = sizeof (EFI_GUID);
+ DhcpHeader->HwAddrLen = (UINT8) sizeof (EFI_GUID);
}
Xid = NET_RANDOM (NetRandomInitSeed ());
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 50736a9..c3cb765 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -677,7 +677,7 @@ ON_EXIT:
ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA));
ArpConfigData.SwAddressType = 0x0800;
- ArpConfigData.SwAddressLength = sizeof (EFI_IPv4_ADDRESS);
+ ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);
ArpConfigData.StationAddress = &Private->StationIp.v4;
Private->Arp->Configure (Private->Arp, NULL);
@@ -2263,7 +2263,7 @@ EfiPxeBcSetStationIP (
ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA));
ArpConfigData.SwAddressType = 0x0800;
- ArpConfigData.SwAddressLength = sizeof (EFI_IPv4_ADDRESS);
+ ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);
ArpConfigData.StationAddress = &Private->StationIp.v4;
Private->Arp->Configure (Private->Arp, NULL);