summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreast <andreast@FreeBSD.org>2011-01-20 20:22:19 +0000
committerandreast <andreast@FreeBSD.org>2011-01-20 20:22:19 +0000
commitad366db2011f14e8f5f98e4ccdcb57ffd22f5c23 (patch)
tree1bc649a6a9120b09ca9537efad913192c55e6946
parent6d8a904d4902ca85ab4a35457d4844b3e2db8f7e (diff)
downloadFreeBSD-src-ad366db2011f14e8f5f98e4ccdcb57ffd22f5c23.zip
FreeBSD-src-ad366db2011f14e8f5f98e4ccdcb57ffd22f5c23.tar.gz
Correct parsing of the grackle and uninorthpci ranges property.
Approved by: nwhitehorn (mentor)
-rw-r--r--sys/powerpc/powermac/grackle.c5
-rw-r--r--sys/powerpc/powermac/gracklevar.h2
-rw-r--r--sys/powerpc/powermac/uninorthpci.c5
-rw-r--r--sys/powerpc/powermac/uninorthvar.h2
4 files changed, 10 insertions, 4 deletions
diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c
index a7ba6cb..ee7fb38 100644
--- a/sys/powerpc/powermac/grackle.c
+++ b/sys/powerpc/powermac/grackle.c
@@ -199,11 +199,14 @@ grackle_attach(device_t dev)
return (ENXIO);
}
+ sc->sc_nrange /= sizeof(sc->sc_range[0]);
+
sc->sc_range[6].pci_hi = 0;
io = NULL;
nmem = 0;
- for (rp = sc->sc_range; rp->pci_hi != 0; rp++) {
+ for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange &&
+ rp->pci_hi != 0; rp++) {
switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) {
case OFW_PCI_PHYS_HI_SPACE_CONFIG:
break;
diff --git a/sys/powerpc/powermac/gracklevar.h b/sys/powerpc/powermac/gracklevar.h
index 8d58c0a..bc8b664 100644
--- a/sys/powerpc/powermac/gracklevar.h
+++ b/sys/powerpc/powermac/gracklevar.h
@@ -45,7 +45,7 @@ struct grackle_softc {
vm_offset_t sc_addr;
vm_offset_t sc_data;
int sc_bus;
- struct grackle_range sc_range[6];
+ struct grackle_range sc_range[7];
int sc_nrange;
int sc_iostart;
struct rman sc_io_rman;
diff --git a/sys/powerpc/powermac/uninorthpci.c b/sys/powerpc/powermac/uninorthpci.c
index cfc8862..421c7e5 100644
--- a/sys/powerpc/powermac/uninorthpci.c
+++ b/sys/powerpc/powermac/uninorthpci.c
@@ -231,11 +231,14 @@ uninorth_attach(device_t dev)
return (ENXIO);
}
+ sc->sc_nrange /= sizeof(sc->sc_range[0]);
+
sc->sc_range[6].pci_hi = 0;
io = NULL;
nmem = 0;
- for (rp = sc->sc_range; rp->pci_hi != 0; rp++) {
+ for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange &&
+ rp->pci_hi != 0; rp++) {
switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) {
case OFW_PCI_PHYS_HI_SPACE_CONFIG:
break;
diff --git a/sys/powerpc/powermac/uninorthvar.h b/sys/powerpc/powermac/uninorthvar.h
index 9625d42..2c37d77 100644
--- a/sys/powerpc/powermac/uninorthvar.h
+++ b/sys/powerpc/powermac/uninorthvar.h
@@ -53,7 +53,7 @@ struct uninorth_softc {
vm_offset_t sc_addr;
vm_offset_t sc_data;
int sc_bus;
- struct uninorth_range sc_range[6];
+ struct uninorth_range sc_range[7];
int sc_nrange;
int sc_iostart;
struct rman sc_io_rman;
OpenPOWER on IntegriCloud