]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
Terminate the Capability List traversal if the Capability Pointer is less than 0x40...
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciCommand.c
index af11143e92af2c66b310be2049dbbcd906572657..31bdd8d23425b33171dd0c8cf634891378d16f96 100644 (file)
@@ -153,11 +153,7 @@ LocateCapabilityRegBlock (
     }\r
   }\r
 \r
     }\r
   }\r
 \r
-  while (CapabilityPtr > 0x3F) {\r
-    //\r
-    // Mask it to DWORD alignment per PCI spec\r
-    //\r
-    CapabilityPtr &= 0xFC;\r
+  while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {\r
     PciIoRead (\r
                 &PciIoDevice->PciIo,\r
                 EfiPciIoWidthUint16,\r
     PciIoRead (\r
                 &PciIoDevice->PciIo,\r
                 EfiPciIoWidthUint16,\r