diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-09-15 07:48:11 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-09-15 07:48:11 +0000 |
commit | c9325700d0ef25eaf45077928af3f93b15ac5fe0 (patch) | |
tree | c46ae68c26db3a5a6a9e58b37b53265aa2f770d3 /MdeModulePkg/Universal | |
parent | f6b4e53dfe43c27d448cedb57059e5b7ca236dd8 (diff) | |
download | edk2-platforms-c9325700d0ef25eaf45077928af3f93b15ac5fe0.tar.xz |
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')
25 files changed, 145 insertions, 113 deletions
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePath.h b/MdeModulePkg/Universal/DevicePathDxe/DevicePath.h index c62e9a1eb0..8c0db78756 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePath.h +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePath.h @@ -43,11 +43,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define IS_NULL(a) ((a) == L'\0')
-#define SET_DEVICE_PATH_INSTANCE_END_NODE(a) { \
- (a)->Type = END_DEVICE_PATH_TYPE; \
- (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
- (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
- (a)->Length[1] = 0; \
+#define SET_DEVICE_PATH_INSTANCE_END_NODE(a) { \
+ (a)->Type = END_DEVICE_PATH_TYPE; \
+ (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
+ (a)->Length[0] = (UINT8) sizeof (EFI_DEVICE_PATH_PROTOCOL); \
+ (a)->Length[1] = 0; \
}
//
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c index ebacd12f2b..162b0e9ef4 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c @@ -708,7 +708,7 @@ DevPathFromTextPci ( Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_PCI_DP,
- sizeof (PCI_DEVICE_PATH)
+ (UINT16) sizeof (PCI_DEVICE_PATH)
);
Pci->Function = (UINT8) Strtoi (FunctionStr);
@@ -737,7 +737,7 @@ DevPathFromTextPcCard ( Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_PCCARD_DP,
- sizeof (PCCARD_DEVICE_PATH)
+ (UINT16) sizeof (PCCARD_DEVICE_PATH)
);
Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr);
@@ -769,7 +769,7 @@ DevPathFromTextMemoryMapped ( MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_MEMMAP_DP,
- sizeof (MEMMAP_DEVICE_PATH)
+ (UINT16) sizeof (MEMMAP_DEVICE_PATH)
);
MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr);
@@ -863,7 +863,7 @@ DevPathFromTextCtrl ( Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_CONTROLLER_DP,
- sizeof (CONTROLLER_DEVICE_PATH)
+ (UINT16) sizeof (CONTROLLER_DEVICE_PATH)
);
Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);
@@ -914,7 +914,7 @@ DevPathFromTextAcpi ( Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
ACPI_DEVICE_PATH,
ACPI_DP,
- sizeof (ACPI_HID_DEVICE_PATH)
+ (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
);
EisaIdFromText (HIDStr, &Acpi->HID);
@@ -945,7 +945,7 @@ ConvertFromTextAcpi ( Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
ACPI_DEVICE_PATH,
ACPI_DP,
- sizeof (ACPI_HID_DEVICE_PATH)
+ (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
);
Acpi->HID = EFI_PNP_ID (PnPId);
@@ -1158,7 +1158,7 @@ DevPathFromTextAta ( Atapi = (ATAPI_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_ATAPI_DP,
- sizeof (ATAPI_DEVICE_PATH)
+ (UINT16) sizeof (ATAPI_DEVICE_PATH)
);
PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode);
@@ -1194,7 +1194,7 @@ DevPathFromTextScsi ( Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SCSI_DP,
- sizeof (SCSI_DEVICE_PATH)
+ (UINT16) sizeof (SCSI_DEVICE_PATH)
);
Scsi->Pun = (UINT16) Strtoi (PunStr);
@@ -1225,7 +1225,7 @@ DevPathFromTextFibre ( Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_FIBRECHANNEL_DP,
- sizeof (FIBRECHANNEL_DEVICE_PATH)
+ (UINT16) sizeof (FIBRECHANNEL_DEVICE_PATH)
);
Fibre->Reserved = 0;
@@ -1255,7 +1255,7 @@ DevPathFromText1394 ( F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_1394_DP,
- sizeof (F1394_DEVICE_PATH)
+ (UINT16) sizeof (F1394_DEVICE_PATH)
);
F1394DevPath->Reserved = 0;
@@ -1286,7 +1286,7 @@ DevPathFromTextUsb ( Usb = (USB_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_USB_DP,
- sizeof (USB_DEVICE_PATH)
+ (UINT16) sizeof (USB_DEVICE_PATH)
);
Usb->ParentPortNumber = (UINT8) Strtoi (PortStr);
@@ -1315,7 +1315,7 @@ DevPathFromTextI2O ( I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_I2O_DP,
- sizeof (I2O_DEVICE_PATH)
+ (UINT16) sizeof (I2O_DEVICE_PATH)
);
I2ODevPath->Tid = (UINT32) Strtoi (TIDStr);
@@ -1352,7 +1352,7 @@ DevPathFromTextInfiniband ( InfiniBand = (INFINIBAND_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_INFINIBAND_DP,
- sizeof (INFINIBAND_DEVICE_PATH)
+ (UINT16) sizeof (INFINIBAND_DEVICE_PATH)
);
InfiniBand->ResourceFlags = (UINT32) Strtoi (FlagsStr);
@@ -1403,7 +1403,7 @@ DevPathFromTextVenPcAnsi ( Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
@@ -1427,7 +1427,7 @@ DevPathFromTextVenVt100 ( Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiVT100Guid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
@@ -1451,7 +1451,7 @@ DevPathFromTextVenVt100Plus ( Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
@@ -1475,7 +1475,7 @@ DevPathFromTextVenUtf8 ( Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
@@ -1501,7 +1501,7 @@ DevPathFromTextUartFlowCtrl ( UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
+ (UINT16) sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
);
CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);
@@ -1552,7 +1552,7 @@ DevPathFromTextSAS ( Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (SAS_DEVICE_PATH)
+ (UINT16) sizeof (SAS_DEVICE_PATH)
);
CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid);
@@ -1604,7 +1604,7 @@ DevPathFromTextDebugPort ( Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
+ (UINT16) sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
);
CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);
@@ -1635,7 +1635,7 @@ DevPathFromTextMAC ( MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_MAC_ADDR_DP,
- sizeof (MAC_ADDR_DEVICE_PATH)
+ (UINT16) sizeof (MAC_ADDR_DEVICE_PATH)
);
MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr);
@@ -1698,7 +1698,7 @@ DevPathFromTextIPv4 ( IPv4 = (IPv4_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_IPv4_DP,
- sizeof (IPv4_DEVICE_PATH)
+ (UINT16) sizeof (IPv4_DEVICE_PATH)
);
StrToIPv4Addr (&RemoteIPStr, &IPv4->RemoteIpAddress);
@@ -1743,7 +1743,7 @@ DevPathFromTextIPv6 ( IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_IPv6_DP,
- sizeof (IPv6_DEVICE_PATH)
+ (UINT16) sizeof (IPv6_DEVICE_PATH)
);
StrToIPv6Addr (&RemoteIPStr, &IPv6->RemoteIpAddress);
@@ -1788,7 +1788,7 @@ DevPathFromTextUart ( Uart = (UART_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_UART_DP,
- sizeof (UART_DEVICE_PATH)
+ (UINT16) sizeof (UART_DEVICE_PATH)
);
Uart->BaudRate = (StrCmp (BaudStr, L"DEFAULT") == 0) ? 115200 : Dtoi (BaudStr);
@@ -1861,7 +1861,7 @@ ConvertFromTextUsbClass ( UsbClass = (USB_CLASS_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_USB_CLASS_DP,
- sizeof (USB_CLASS_DEVICE_PATH)
+ (UINT16) sizeof (USB_CLASS_DEVICE_PATH)
);
VIDStr = GetNextParamStr (&TextDeviceNode);
@@ -2395,7 +2395,7 @@ DevPathFromTextVlan ( Vlan = (VLAN_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VLAN_DP,
- sizeof (VLAN_DEVICE_PATH)
+ (UINT16) sizeof (VLAN_DEVICE_PATH)
);
Vlan->VlanId = (UINT16) Strtoi (VlanStr);
@@ -2433,7 +2433,7 @@ DevPathFromTextHD ( Hd = (HARDDRIVE_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_HARDDRIVE_DP,
- sizeof (HARDDRIVE_DEVICE_PATH)
+ (UINT16) sizeof (HARDDRIVE_DEVICE_PATH)
);
Hd->PartitionNumber = (UINT32) Dtoi (PartitionStr);
@@ -2487,7 +2487,7 @@ DevPathFromTextCDROM ( CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_CDROM_DP,
- sizeof (CDROM_DEVICE_PATH)
+ (UINT16) sizeof (CDROM_DEVICE_PATH)
);
CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr);
@@ -2563,7 +2563,7 @@ DevPathFromTextMedia ( Media = (MEDIA_PROTOCOL_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PROTOCOL_DP,
- sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
+ (UINT16) sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
);
StrToGuid (GuidStr, &Media->Protocol);
@@ -2591,7 +2591,7 @@ DevPathFromTextFv ( Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_VOL_DP,
- sizeof (MEDIA_FW_VOL_DEVICE_PATH)
+ (UINT16) sizeof (MEDIA_FW_VOL_DEVICE_PATH)
);
StrToGuid (GuidStr, &Fv->FvName);
@@ -2619,7 +2619,7 @@ DevPathFromTextFvFile ( FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_FILE_DP,
- sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
+ (UINT16) sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
);
StrToGuid (GuidStr, &FvFile->FvFileName);
@@ -2649,7 +2649,7 @@ DevPathFromTextRelativeOffsetRange ( Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_RELATIVE_OFFSET_RANGE_DP,
- sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)
+ (UINT16) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)
);
Strtoi64 (StartingOffsetStr, &Offset->StartingOffset);
@@ -2741,7 +2741,7 @@ DevPathFromTextSata ( Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SATA_DP,
- sizeof (SATA_DEVICE_PATH)
+ (UINT16) sizeof (SATA_DEVICE_PATH)
);
Sata->HBAPortNumber = (UINT16) Xtoi (Param1);
if (Param3 != NULL) {
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c index 29fcb2c418..48f7dcebdb 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c @@ -1718,7 +1718,7 @@ ExecuteMOVxx ( //
// Not indirect source: MOVxx {@}Rx, Ry [Index]
//
- Data64 = VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index64Op2;
+ Data64 = (UINT64) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Index64Op2);
//
// Did Operand2 have an index? If so, treat as two signed values since
// indexes are signed values.
@@ -2005,7 +2005,7 @@ ExecuteJMP ( // 64-bit immediate data is full address. Read the immediate data,
// check for alignment, and jump absolute.
//
- Data64 = VmReadImmed64 (VmPtr, 2);
+ Data64 = (UINT64) VmReadImmed64 (VmPtr, 2);
if (!IS_ALIGNED ((UINTN) Data64, sizeof (UINT16))) {
EbcDebugSignalException (
EXCEPT_EBC_ALIGNMENT_CHECK,
@@ -2049,7 +2049,7 @@ ExecuteJMP ( if (OPERAND1_REGNUM (Operand) == 0) {
Data64 = 0;
} else {
- Data64 = OPERAND1_REGDATA (VmPtr, Operand);
+ Data64 = (UINT64) OPERAND1_REGDATA (VmPtr, Operand);
}
//
// Decode the forms
@@ -2264,7 +2264,7 @@ ExecuteMOVI ( } else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH32) {
VmWriteMem32 (VmPtr, (UINTN) Op1, (UINT32) ImmData64);
} else {
- VmWriteMem64 (VmPtr, (UINTN) Op1, ImmData64);
+ VmWriteMem64 (VmPtr, (UINTN) Op1, (UINT64) ImmData64);
}
}
//
@@ -2551,9 +2551,9 @@ ExecuteMOVsnw ( //
// Get the data from the source.
//
- Op2 = (INT64) ((INTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index));
+ Op2 = (UINT64) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index);
if (OPERAND2_INDIRECT (Operands)) {
- Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
+ Op2 = (UINT64) VmReadMemN (VmPtr, (UINTN) Op2);
}
//
// Now write back the result.
@@ -2644,9 +2644,9 @@ ExecuteMOVsnd ( //
// Get the data from the source.
//
- Op2 = (INT64) ((INTN) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index));
+ Op2 = (UINT64) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index);
if (OPERAND2_INDIRECT (Operands)) {
- Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
+ Op2 = (UINT64) VmReadMemN (VmPtr, (UINTN) Op2);
}
//
// Now write back the result.
@@ -3698,7 +3698,7 @@ ExecuteDIVU ( // Get the destination register
//
if ((*VmPtr->Ip & DATAMANIP_M_64) != 0) {
- return (UINT64) (DivU64x64Remainder ((INT64)Op1, (INT64)Op2, &Remainder));
+ return (UINT64) (DivU64x64Remainder (Op1, Op2, &Remainder));
} else {
return (UINT64) ((UINT32) Op1 / (UINT32) Op2);
}
@@ -4195,7 +4195,7 @@ ExecuteDataManip ( // Get operand1 (destination and sometimes also an actual operand)
// of form {@}R1
//
- Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
+ Op1 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
if (OPERAND1_INDIRECT (Operands)) {
if ((Opcode & DATAMANIP_M_64) != 0) {
Op1 = VmReadMem64 (VmPtr, (UINTN) Op1);
@@ -4238,7 +4238,7 @@ ExecuteDataManip ( // Write back the result.
//
if (OPERAND1_INDIRECT (Operands)) {
- Op1 = VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
+ Op1 = (UINT64) VmPtr->Gpr[OPERAND1_REGNUM (Operands)];
if ((Opcode & DATAMANIP_M_64) != 0) {
VmWriteMem64 (VmPtr, (UINTN) Op1, Op2);
} else {
@@ -4573,7 +4573,7 @@ VmReadIndex64 ( //
ConstUnits = ARShiftU64 (((Index &~0xF000000000000000ULL) & Mask), (UINTN)NBits);
- Offset = MultU64x64 (NaturalUnits, sizeof (UINTN)) + ConstUnits;
+ Offset = MultU64x64 ((UINT64) NaturalUnits, sizeof (UINTN)) + ConstUnits;
//
// Now set the sign
@@ -4781,7 +4781,6 @@ VmWriteMem64 ( )
{
EFI_STATUS Status;
- UINT32 Data32;
//
// Convert the address if it's in the stack gap
@@ -4803,8 +4802,7 @@ VmWriteMem64 ( }
MemoryFence ();
- Data32 = (UINT32) (((UINT32 *) &Data)[1]);
- if ((Status = VmWriteMem32 (VmPtr, Addr + sizeof (UINT32), Data32)) != EFI_SUCCESS) {
+ if ((Status = VmWriteMem32 (VmPtr, Addr + sizeof (UINT32), (UINT32) RShiftU64(Data, 32))) != EFI_SUCCESS) {
return Status;
}
@@ -5259,9 +5257,9 @@ VmReadMem64 ( //
// Return unaligned data. Assume little endian.
//
- Data = (UINT64) VmReadMem32 (VmPtr, Addr);
- Data32 = VmReadMem32 (VmPtr, Addr + sizeof (UINT32));
- *(UINT32 *) ((UINT32 *) &Data + 1) = Data32;
+ Data32 = VmReadMem32 (VmPtr, Addr);
+ Data = (UINT64) VmReadMem32 (VmPtr, Addr + sizeof (UINT32));
+ Data = LShiftU64 (Data, 32) | Data32;
return Data;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcInt.c b/MdeModulePkg/Universal/EbcDxe/EbcInt.c index 9357dcd26e..dddfd58566 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcInt.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcInt.c @@ -767,14 +767,14 @@ EbcDebugSignalException ( //
// Initialize the context structure
//
- EbcContext.R0 = VmPtr->Gpr[0];
- EbcContext.R1 = VmPtr->Gpr[1];
- EbcContext.R2 = VmPtr->Gpr[2];
- EbcContext.R3 = VmPtr->Gpr[3];
- EbcContext.R4 = VmPtr->Gpr[4];
- EbcContext.R5 = VmPtr->Gpr[5];
- EbcContext.R6 = VmPtr->Gpr[6];
- EbcContext.R7 = VmPtr->Gpr[7];
+ EbcContext.R0 = (UINT64) VmPtr->Gpr[0];
+ EbcContext.R1 = (UINT64) VmPtr->Gpr[1];
+ EbcContext.R2 = (UINT64) VmPtr->Gpr[2];
+ EbcContext.R3 = (UINT64) VmPtr->Gpr[3];
+ EbcContext.R4 = (UINT64) VmPtr->Gpr[4];
+ EbcContext.R5 = (UINT64) VmPtr->Gpr[5];
+ EbcContext.R6 = (UINT64) VmPtr->Gpr[6];
+ EbcContext.R7 = (UINT64) VmPtr->Gpr[7];
EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
EbcContext.Flags = VmPtr->Flags;
EbcContext.ControlFlags = 0;
@@ -937,14 +937,14 @@ EbcDebugPeriodic ( //
// Initialize the context structure
//
- EbcContext.R0 = VmPtr->Gpr[0];
- EbcContext.R1 = VmPtr->Gpr[1];
- EbcContext.R2 = VmPtr->Gpr[2];
- EbcContext.R3 = VmPtr->Gpr[3];
- EbcContext.R4 = VmPtr->Gpr[4];
- EbcContext.R5 = VmPtr->Gpr[5];
- EbcContext.R6 = VmPtr->Gpr[6];
- EbcContext.R7 = VmPtr->Gpr[7];
+ EbcContext.R0 = (UINT64) VmPtr->Gpr[0];
+ EbcContext.R1 = (UINT64) VmPtr->Gpr[1];
+ EbcContext.R2 = (UINT64) VmPtr->Gpr[2];
+ EbcContext.R3 = (UINT64) VmPtr->Gpr[3];
+ EbcContext.R4 = (UINT64) VmPtr->Gpr[4];
+ EbcContext.R5 = (UINT64) VmPtr->Gpr[5];
+ EbcContext.R6 = (UINT64) VmPtr->Gpr[6];
+ EbcContext.R7 = (UINT64) VmPtr->Gpr[7];
EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
EbcContext.Flags = VmPtr->Flags;
EbcContext.ControlFlags = 0;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index eca4fefc93..2e73924ca1 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -1099,7 +1099,7 @@ ParseIfrData ( // Get Offset/Width by Question header and OneOf Flags
//
VarOffset = IfrCheckBox->Question.VarStoreInfo.VarOffset;
- VarWidth = sizeof (BOOLEAN);
+ VarWidth = (UINT16) sizeof (BOOLEAN);
//
// Check whether this question is in requested block array.
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c index 2b1f9f1e84..f90fff82f2 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c @@ -70,7 +70,7 @@ IScsiInitControlSection ( Control->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_ID;
Control->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_VERSION;
- Control->Header.Length = sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE);
+ Control->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE);
//
// Each session occupies two offsets, one for the NIC section,
@@ -144,7 +144,7 @@ IScsiFillInitiatorSection ( Initiator->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_ID;
Initiator->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_VERSION;
- Initiator->Header.Length = sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE);
+ Initiator->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE);
Initiator->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BLOCK_VALID | EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BOOT_SELECTED;
//
@@ -305,7 +305,7 @@ IScsiFillNICAndTargetSections ( Nic->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_ID;
Nic->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_VERSION;
- Nic->Header.Length = sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE);
+ Nic->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE);
Nic->Header.Index = (UINT8) Index;
Nic->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BLOCK_VALID |
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BOOT_SELECTED |
@@ -351,7 +351,7 @@ IScsiFillNICAndTargetSections ( Target->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_ID;
Target->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_VERSION;
- Target->Header.Length = sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE);
+ Target->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE);
Target->Header.Index = (UINT8) Index;
Target->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID | EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED;
Target->Port = SessionConfigData->NvData.TargetPort;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Initialize.c b/MdeModulePkg/Universal/Network/SnpDxe/Initialize.c index 56f7283b5e..3f40ef3ce7 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Initialize.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Initialize.c @@ -84,8 +84,8 @@ PxeInit ( Snp->Cdb.OpCode = PXE_OPCODE_INITIALIZE;
Snp->Cdb.OpFlags = CableDetectFlag;
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_INITIALIZE);
- Snp->Cdb.DBsize = sizeof (PXE_DB_INITIALIZE);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_INITIALIZE);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_INITIALIZE);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Snp->Cpb;
Snp->Cdb.DBaddr = (UINT64)(UINTN) Snp->Db;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c b/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c index f4294c03d1..23dba90194 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c @@ -45,8 +45,8 @@ PxeIp2Mac ( Db = Snp->Db;
Snp->Cdb.OpCode = PXE_OPCODE_MCAST_IP_TO_MAC;
Snp->Cdb.OpFlags = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_MCAST_IP_TO_MAC);
- Snp->Cdb.DBsize = sizeof (PXE_DB_MCAST_IP_TO_MAC);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_MCAST_IP_TO_MAC);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_MCAST_IP_TO_MAC);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c b/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c index a6368d1b80..443979087e 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c @@ -48,7 +48,7 @@ PxeNvDataRead ( Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- Snp->Cdb.DBsize = sizeof (PXE_DB_NVDATA);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_NVDATA);
Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Receive.c b/MdeModulePkg/Universal/Network/SnpDxe/Receive.c index adc1fb2711..ace5630066 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Receive.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Receive.c @@ -68,10 +68,10 @@ PxeReceive ( Snp->Cdb.OpCode = PXE_OPCODE_RECEIVE;
Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_RECEIVE);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_RECEIVE);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
- Snp->Cdb.DBsize = sizeof (PXE_DB_RECEIVE);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_RECEIVE);
Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c index 13f57a1f54..e90e4e0244 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c @@ -483,8 +483,8 @@ SimpleNetworkDriverStart ( Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
Snp->Cdb.CPBaddr = PXE_DBADDR_NOT_USED;
- Snp->Cdb.DBsize = sizeof Snp->InitInfo;
- Snp->Cdb.DBaddr = (UINT64)(UINTN) &Snp->InitInfo;
+ Snp->Cdb.DBsize = (UINT16) sizeof (Snp->InitInfo);
+ Snp->Cdb.DBaddr = (UINT64)(UINTN) (&Snp->InitInfo);
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
@@ -513,7 +513,7 @@ SimpleNetworkDriverStart ( Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
Snp->Cdb.CPBaddr = PXE_DBADDR_NOT_USED;
- Snp->Cdb.DBsize = sizeof ConfigInfo;
+ Snp->Cdb.DBsize = (UINT16) sizeof (ConfigInfo);
Snp->Cdb.DBaddr = (UINT64)(UINTN) &ConfigInfo;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Start.c b/MdeModulePkg/Universal/Network/SnpDxe/Start.c index 8e48625c9b..210f081078 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Start.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Start.c @@ -51,7 +51,7 @@ PxeStart ( // a S/W UNDI.
//
if (Snp->IsSwUndi) {
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_START_31);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_START_31);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb31;
Cpb31->Delay = (UINT64)(UINTN) &SnpUndi32CallbackDelay;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Station_address.c b/MdeModulePkg/Universal/Network/SnpDxe/Station_address.c index 5a98e0f256..3807188683 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Station_address.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Station_address.c @@ -39,7 +39,7 @@ PxeGetStnAddr ( Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- Snp->Cdb.DBsize = sizeof (PXE_DB_STATION_ADDRESS);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_STATION_ADDRESS);
Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
@@ -124,11 +124,11 @@ PxeSetStnAddr ( //
CopyMem (&Cpb->StationAddr, NewMacAddr, Snp->Mode.HwAddressSize);
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_STATION_ADDRESS);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_STATION_ADDRESS);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
}
- Snp->Cdb.DBsize = sizeof (PXE_DB_STATION_ADDRESS);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_STATION_ADDRESS);
Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c b/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c index b5ca994fe7..3e564991e3 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c @@ -133,7 +133,7 @@ SnpUndi32Statistics ( Db = Snp->Db;
} else {
Snp->Cdb.OpFlags = PXE_OPFLAGS_STATISTICS_READ;
- Snp->Cdb.DBsize = sizeof (PXE_DB_STATISTICS);
+ Snp->Cdb.DBsize = (UINT16) sizeof (PXE_DB_STATISTICS);
Snp->Cdb.DBaddr = (UINT64)(UINTN) (Db = Snp->Db);
}
//
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c index 989481e0f8..ac6b66424d 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c @@ -162,7 +162,7 @@ PxeTransmit ( Snp->Cdb.OpFlags = PXE_OPFLAGS_TRANSMIT_WHOLE;
- Snp->Cdb.CPBsize = sizeof (PXE_CPB_TRANSMIT);
+ Snp->Cdb.CPBsize = (UINT16) sizeof (PXE_CPB_TRANSMIT);
Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
Snp->Cdb.OpCode = PXE_OPCODE_TRANSMIT;
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/WaitForPacket.c b/MdeModulePkg/Universal/Network/SnpDxe/WaitForPacket.c index 1d74481797..23d7455fd1 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/WaitForPacket.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/WaitForPacket.c @@ -56,7 +56,7 @@ SnpWaitForPacketNotify ( ((SNP_DRIVER *) SnpPtr)->Cdb.OpFlags = 0;
((SNP_DRIVER *) SnpPtr)->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
((SNP_DRIVER *) SnpPtr)->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- ((SNP_DRIVER *) SnpPtr)->Cdb.DBsize = sizeof (UINT32) * 2;
+ ((SNP_DRIVER *) SnpPtr)->Cdb.DBsize = (UINT16) (sizeof (UINT32) * 2);
((SNP_DRIVER *) SnpPtr)->Cdb.DBaddr = (UINT64)(UINTN) (((SNP_DRIVER *) SnpPtr)->Db);
((SNP_DRIVER *) SnpPtr)->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
((SNP_DRIVER *) SnpPtr)->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c index e3285f572b..22c312b5fd 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c @@ -677,6 +677,8 @@ Tcp4ServiceBindingCreateChild ( *ChildHandle = Sock->SockHandle;
}
+ mTcp4DefaultSockData.ProtoData = NULL;
+
gBS->RestoreTPL (OldTpl);
return Status;
}
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c index 62c8e5b5ac..2ed3c254f3 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c @@ -657,7 +657,7 @@ TcpResetConnection ( Nhead->Ack = HTONL (Tcb->RcvNxt);
Nhead->SrcPort = Tcb->LocalEnd.Port;
Nhead->DstPort = Tcb->RemoteEnd.Port;
- Nhead->HeadLen = (sizeof (TCP_HEAD) >> 2);
+ Nhead->HeadLen = (UINT8) (sizeof (TCP_HEAD) >> 2);
Nhead->Res = 0;
Nhead->Wnd = HTONS (0xFFFF);
Nhead->Checksum = 0;
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c index 095030551d..b44e851b26 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c @@ -1094,7 +1094,7 @@ TcpSendReset ( Nhead->SrcPort = Head->DstPort;
Nhead->DstPort = Head->SrcPort;
- Nhead->HeadLen = (sizeof (TCP_HEAD) >> 2);
+ Nhead->HeadLen = (UINT8) (sizeof (TCP_HEAD) >> 2);
Nhead->Res = 0;
Nhead->Wnd = HTONS (0xFFFF);
Nhead->Checksum = 0;
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index ce58321eb0..6b25cab33d 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 50736a9731..c3cb765837 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);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index 4c8aad1c8c..b124b72088 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -1063,11 +1063,11 @@ ParseOpCodes ( break;
case EFI_IFR_TYPE_DATE:
- ExpressionOpCode->ValueWidth = sizeof (EFI_IFR_DATE);
+ ExpressionOpCode->ValueWidth = (UINT8) sizeof (EFI_IFR_DATE);
break;
case EFI_IFR_TYPE_TIME:
- ExpressionOpCode->ValueWidth = sizeof (EFI_IFR_TIME);
+ ExpressionOpCode->ValueWidth = (UINT8) sizeof (EFI_IFR_TIME);
break;
case EFI_IFR_TYPE_OTHER:
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 0d3c1ebce8..d916aeb8cf 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -2296,6 +2296,7 @@ UiDisplayMenu ( //
// Don't print anything if it is a NULL help token
//
+ ASSERT(MenuOption != NULL);
if (MenuOption->ThisTag->Help == 0) {
StringPtr = L"\0";
} else {
@@ -2372,6 +2373,16 @@ UiDisplayMenu ( //
case '+':
case '-':
+ //
+ // If the screen has no menu items, and the user didn't select UiReset
+ // ignore the selection and go back to reading keys.
+ //
+ if(IsListEmpty (&gMenuOption)) {
+ ControlFlag = CfReadKey;
+ break;
+ }
+
+ ASSERT(MenuOption != NULL);
Statement = MenuOption->ThisTag;
if ((Statement->Operand == EFI_IFR_DATE_OP)
|| (Statement->Operand == EFI_IFR_TIME_OP)
@@ -2407,6 +2418,16 @@ UiDisplayMenu ( case ' ':
if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) != FORMSET_CLASS_FRONT_PAGE) {
+ //
+ // If the screen has no menu items, and the user didn't select UiReset
+ // ignore the selection and go back to reading keys.
+ //
+ if(IsListEmpty (&gMenuOption)) {
+ ControlFlag = CfReadKey;
+ break;
+ }
+
+ ASSERT(MenuOption != NULL);
if (MenuOption->ThisTag->Operand == EFI_IFR_CHECKBOX_OP && !MenuOption->GrayOut) {
ScreenOperation = UiSelect;
}
@@ -2478,6 +2499,7 @@ UiDisplayMenu ( case CfUiSelect:
ControlFlag = CfCheckSelection;
+ ASSERT(MenuOption != NULL);
Statement = MenuOption->ThisTag;
if ((Statement->Operand == EFI_IFR_TEXT_OP) ||
(Statement->Operand == EFI_IFR_DATE_OP) ||
@@ -2744,11 +2766,13 @@ UiDisplayMenu ( case CfUiLeft:
ControlFlag = CfCheckSelection;
+ ASSERT(MenuOption != NULL);
if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
if (MenuOption->Sequence != 0) {
//
// In the middle or tail of the Date/Time op-code set, go left.
//
+ ASSERT(NewPos != NULL);
NewPos = NewPos->BackLink;
}
}
@@ -2756,11 +2780,13 @@ UiDisplayMenu ( case CfUiRight:
ControlFlag = CfCheckSelection;
+ ASSERT(MenuOption != NULL);
if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
if (MenuOption->Sequence != 2) {
//
// In the middle or tail of the Date/Time op-code set, go left.
//
+ ASSERT(NewPos != NULL);
NewPos = NewPos->ForwardLink;
}
}
@@ -2771,6 +2797,7 @@ UiDisplayMenu ( SavedListEntry = TopOfScreen;
+ ASSERT(NewPos != NULL);
if (NewPos->BackLink != &gMenuOption) {
NewLine = TRUE;
//
@@ -2800,6 +2827,7 @@ UiDisplayMenu ( // Check the previous menu entry to see if it was a zero-length advance. If it was,
// don't worry about a redraw.
//
+ ASSERT(MenuOption != NULL);
if ((INTN) MenuOption->Row - (INTN) DistanceValue < (INTN) TopRow) {
Repaint = TRUE;
TopOfScreen = NewPos;
@@ -2857,6 +2885,7 @@ UiDisplayMenu ( case CfUiPageUp:
ControlFlag = CfCheckSelection;
+ ASSERT(NewPos != NULL);
if (NewPos->BackLink == &gMenuOption) {
NewLine = FALSE;
Repaint = FALSE;
@@ -3115,6 +3144,7 @@ UiDisplayMenu ( Status = SubmitForm (Selection->FormSet, Selection->Form);
if (!EFI_ERROR (Status)) {
+ ASSERT(MenuOption != NULL);
UpdateStatusBar (INPUT_ERROR, MenuOption->ThisTag->QuestionFlags, FALSE);
UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->QuestionFlags, FALSE);
} else {
diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c index f9ad65e14b..a3bb0a4752 100644 --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c @@ -379,7 +379,7 @@ SmbiosAdd ( // Build internal record Header
//
InternalRecord->Version = EFI_SMBIOS_RECORD_HEADER_VERSION;
- InternalRecord->HeaderSize = sizeof (EFI_SMBIOS_RECORD_HEADER);
+ InternalRecord->HeaderSize = (UINT16) sizeof (EFI_SMBIOS_RECORD_HEADER);
InternalRecord->RecordSize = RecordSize;
InternalRecord->ProducerHandle = ProducerHandle;
InternalRecord->NumberOfStrings = NumberOfStrings;
@@ -541,7 +541,7 @@ SmbiosUpdateString ( // Build internal record Header
//
InternalRecord->Version = EFI_SMBIOS_RECORD_HEADER_VERSION;
- InternalRecord->HeaderSize = sizeof (EFI_SMBIOS_RECORD_HEADER);
+ InternalRecord->HeaderSize = (UINT16) sizeof (EFI_SMBIOS_RECORD_HEADER);
InternalRecord->RecordSize = SmbiosEntry->RecordHeader->RecordSize + InputStrLen - TargetStrLen;
InternalRecord->ProducerHandle = SmbiosEntry->RecordHeader->ProducerHandle;
InternalRecord->NumberOfStrings = SmbiosEntry->RecordHeader->NumberOfStrings;
@@ -864,7 +864,7 @@ SmbiosCreateTable ( //
GetMaxSmbiosHandle(SmbiosProtocol, &SmbiosHandle);
EndStructure.Header.Type = EFI_SMBIOS_TYPE_END_OF_TABLE;
- EndStructure.Header.Length = sizeof(EFI_SMBIOS_TABLE_HEADER);
+ EndStructure.Header.Length = (UINT8) sizeof (EFI_SMBIOS_TABLE_HEADER);
EndStructure.Header.Handle = SmbiosHandle;
EndStructure.Tailing[0] = 0;
EndStructure.Tailing[1] = 0;
diff --git a/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c index cbc848170e..e7bbcf4871 100644 --- a/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c +++ b/MdeModulePkg/Universal/StatusCodeHandler/Pei/SerialStatusCodeWorker.c @@ -94,7 +94,9 @@ SerialStatusCodeReportWorker ( Value,
Instance
);
-
+
+ ASSERT(CharCount > 0);
+
if (CallerId != NULL) {
CharCount += AsciiSPrint (
&Buffer[CharCount - 1],
|