diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-01-20 15:02:51 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-01-20 15:02:51 +0000 |
commit | c523c0e84efa1c25ca48ae001e51138db42d43d9 (patch) | |
tree | ceeeb142102d195c5088061d0e543ad097ca026f | |
parent | 3a242c4813767f53ae9288800fd49cb7d7476d28 (diff) | |
download | FreeBSD-src-c523c0e84efa1c25ca48ae001e51138db42d43d9.zip FreeBSD-src-c523c0e84efa1c25ca48ae001e51138db42d43d9.tar.gz |
Correct parsing of the cpcht ranges property.
Submitted by: andreast
MFC after: 2 weeks
-rw-r--r-- | sys/powerpc/powermac/cpcht.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/powerpc/powermac/cpcht.c b/sys/powerpc/powermac/cpcht.c index ab5c870..618dd224 100644 --- a/sys/powerpc/powermac/cpcht.c +++ b/sys/powerpc/powermac/cpcht.c @@ -282,7 +282,7 @@ cpcht_configure_htbridge(device_t dev, phandle_t child) { struct cpcht_softc *sc; struct ofw_pci_register pcir; - struct cpcht_range ranges[6], *rp; + struct cpcht_range ranges[7], *rp; int nranges, ptr, nextptr; uint32_t vend, val; int i, nirq, irq; @@ -306,9 +306,10 @@ cpcht_configure_htbridge(device_t dev, phandle_t child) */ bzero(ranges, sizeof(ranges)); nranges = OF_getprop(child, "ranges", ranges, sizeof(ranges)); + nranges /= sizeof(ranges[0]); ranges[6].pci_hi = 0; - for (rp = ranges; rp->pci_hi != 0; rp++) { + for (rp = ranges; rp < ranges + nranges && rp->pci_hi != 0; rp++) { switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; |