summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/ibmphp_pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-12-03 20:18:18 +0100
committerBjorn Helgaas <bhelgaas@google.com>2015-12-11 02:38:06 +0100
commit93de6901766c6821538b74a092e47780a9120fac (patch)
tree05431f12c64191c2b8784afe2001b5a0f99b1a01 /drivers/pci/hotplug/ibmphp_pci.c
parentLinux 4.4-rc2 (diff)
downloadlinux-93de6901766c6821538b74a092e47780a9120fac.tar.xz
linux-93de6901766c6821538b74a092e47780a9120fac.zip
PCI: Check for PCI_HEADER_TYPE_BRIDGE equality, not bitmask
Bit 7 of the "Header Type" register indicates a multi-function device when set. Bits 0-6 contain encoded values, where 0x1 indicates a PCI-PCI bridge. It is incorrect to test this as though it were a mask. For example, while the PCI 3.0 spec only defines values 0x0, 0x1, and 0x2, it's conceivable that a future spec could define 0x3 to mean something else; then tests for "(hdr_type & 0x7f) & PCI_HEADER_TYPE_BRIDGE" would incorrectly succeed for this new 0x3 header type. Test bits 0-6 of the Header Type for equality with PCI_HEADER_TYPE_BRIDGE. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_pci.c')
-rw-r--r--drivers/pci/hotplug/ibmphp_pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
index 814cea22a9fa..5824df538f72 100644
--- a/drivers/pci/hotplug/ibmphp_pci.c
+++ b/drivers/pci/hotplug/ibmphp_pci.c
@@ -1119,7 +1119,7 @@ static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno)
pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class);
debug ("hdr_type behind the bridge is %x\n", hdr_type);
- if (hdr_type & PCI_HEADER_TYPE_BRIDGE) {
+ if ((hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
err ("embedded bridges not supported for hot-plugging.\n");
amount->not_correct = 1;
return amount;