]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Merge tristan's patch:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 14:05:41 +0000 (14:05 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 14:05:41 +0000 (14:05 +0000)
while compiling with GCC I have found two issues in PcatPciRootBridge.c:

* when vendor id is read, the code read 2 * 2 bytes into a buffer of 2 bytes.
  The 'buffer overflow' crashed efi.

* when pci configuration header is read, the code read by chunks of 4 bytes,
  but the buffer is aligned on 2 bytes.  According to the compilation options,
  the reads may fail (and the failure is ignored).

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7602 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridge.c

index 3ebfc16de52a1d56cde0e9545861cd7a7cc4f954..d1280245942f584801716dc1f9a074af1b038ef0 100644 (file)
@@ -183,7 +183,7 @@ Returns:
                                        &PrivateData->Io, \r
                                        EfiPciWidthUint16, \r
                                        Address, \r
-                                       sizeof (VendorId), \r
+                                       sizeof (VendorId) / sizeof (UINT16)\r
                                        &VendorId\r
                                        );\r
         if ((EFI_ERROR (Status)) || ((VendorId == 0xffff) && (Function == 0))) {\r
@@ -205,9 +205,9 @@ Returns:
         //\r
         Status = PrivateData->Io.Pci.Read (\r
                                        &PrivateData->Io, \r
-                                       EfiPciWidthUint32\r
+                                       EfiPciWidthUint16\r
                                        Address, \r
-                                       sizeof (PciConfigurationHeader) / sizeof (UINT32), \r
+                                       sizeof (PciConfigurationHeader) / sizeof (UINT16), \r
                                        &PciConfigurationHeader\r
                                        );\r
         if (EFI_ERROR (Status)) {\r