Skip to content

Commit

Permalink
sparc64: Skip bogus PCI bridge ranges.
Browse files Browse the repository at this point in the history
It seems that when a PCI Express bridge is not in use and has no devices
behind it, the ranges property is bogus.  Specifically the size property
is of the form [0xffffffff:...], and if you add this size to the resource
start address the 64-bit calculation will overflow.

Just check specifically for this size value signature and skip them.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 14, 2014
1 parent 93a6423 commit 4afba24
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/sparc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,17 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
size = GET_64BIT(ranges, 6);
if (flags == 0 || size == 0)
continue;

/* On PCI-Express systems, PCI bridges that have no devices downstream
* have a bogus size value where the first 32-bit cell is 0xffffffff.
* This results in a bogus range where start + size overflows.
*
* Just skip these otherwise the kernel will complain when the resource
* tries to be claimed.
*/
if (size >> 32 == 0xffffffff)
continue;

if (flags & IORESOURCE_IO) {
res = bus->resource[0];
if (res->flags) {
Expand Down

0 comments on commit 4afba24

Please sign in to comment.