From c9325700d0ef25eaf45077928af3f93b15ac5fe0 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Wed, 15 Sep 2010 07:48:11 +0000 Subject: 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 --- .../IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c | 2 +- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 4 ++-- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 2 +- MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'MdeModulePkg/Bus/Pci') diff --git a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c index 6f1a6a10e1..3d581b69fd 100644 --- a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c @@ -346,7 +346,7 @@ PCheckDevice ( Dsc = (EFI_PCI_RESOUCE_DESCRIPTOR *) (ListPtr + 1); AcpiPtr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; - AcpiPtr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR); + AcpiPtr->Len = (UINT16) sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR); AcpiPtr->ResType = (UINT8) Dsc->ResType; AcpiPtr->GenFlag = (UINT8) Dsc->GenFlag; AcpiPtr->SpecificFlag = (UINT8) Dsc->SpecificFlag; diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c index fca0084016..09b58ac0de 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c @@ -983,7 +983,7 @@ PciHostBridgeAdjustAllocation ( // Have no way to get ReqRes, AllocRes & Bar here // ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData)); - AllocFailExtendedData.DevicePathSize = sizeof (EFI_DEVICE_PATH_PROTOCOL); + AllocFailExtendedData.DevicePathSize = (UINT16) sizeof (EFI_DEVICE_PATH_PROTOCOL); AllocFailExtendedData.DevicePath = (UINT8 *) PciResNode->PciDev->DevicePath; AllocFailExtendedData.Bar = PciResNode->Bar; @@ -1108,7 +1108,7 @@ ConstructAcpiResourceRequestor ( // if ((Aperture & 0x01) != 0) { Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; - Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3; + Ptr->Len = (UINT16) (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3); // // Io // diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index fe67dc20cd..0969407831 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1637,7 +1637,7 @@ PciIoGetBarAttributes ( if (NumConfig == 1) { Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR; - Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3; + Ptr->Len = (UINT16) (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3); Ptr->AddrRangeMin = PciIoDevice->PciBar[BarIndex].BaseAddress; Ptr->AddrLen = PciIoDevice->PciBar[BarIndex].Length; diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c index 7a53f36a60..1a0aa6e636 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c @@ -355,7 +355,7 @@ UhciCreateSetupTd ( Td->TdHw.DataBuffer = (UINT32) (UINTN) RequestPhy; Td->Data = Request; - Td->DataLen = sizeof (EFI_USB_DEVICE_REQUEST); + Td->DataLen = (UINT16) sizeof (EFI_USB_DEVICE_REQUEST); return Td; } -- cgit v1.2.3