[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140311174257.23084.80235.stgit@bhelgaas-glaptop.roam.corp.google.com>
Date: Tue, 11 Mar 2014 11:42:57 -0600
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: linux-pci@...r.kernel.org
Cc: Paul Bolle <pebolle@...cali.nl>, Yinghai Lu <yinghai@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] PCI: Check all IORESOURCE_TYPE_BITS in
pci_bus_alloc_from_region()
When allocating space from a bus resource, i.e., from apertures leading to
this bus, make sure the entire resource type matches. The previous code
assumed the IORESOURCE_TYPE_BITS field was a bitmask with only a single bit
set, but this is not true. IORESOURCE_TYPE_BITS is really an enumeration,
and we have to check all the bits.
See 72dcb1197228 ("resources: Add register address resource type").
No functional change. If we used this path for allocating IRQs, DMA
channels, or bus numbers, this would fix a bug because those types are
indistinguishable when masked by IORESOURCE_IO | IORESOURCE_MEM. But we
don't, so this shouldn't make any difference.
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
drivers/pci/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 38901665c770..e3bdc88668ec 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -144,7 +144,7 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
struct resource *r, avail;
resource_size_t max;
- type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
+ type_mask |= IORESOURCE_TYPE_BITS;
pci_bus_for_each_resource(bus, r, i) {
if (!r)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists