summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-11-09 14:26:23 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-11-09 14:26:23 +0000
commit95e8f111b4e15a55228f0b3ad7a0f54fb3407335 (patch)
tree9cf7c8f1890e245cded9d414fb4c0c6f6c49cccd /sys/powerpc/aim
parenta9dc4dbb6208ebff265d4470aa4d32abe2907222 (diff)
downloadFreeBSD-src-95e8f111b4e15a55228f0b3ad7a0f54fb3407335.zip
FreeBSD-src-95e8f111b4e15a55228f0b3ad7a0f54fb3407335.tar.gz
Increase the size of the OFW translations buffer to handle G5 systems
that use many translation regions in firmware, and add bounds checking to prevent buffer overflows in case even the new value is exceeded. Reported by: Jacob Lambert MFC after: 3 days
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r--sys/powerpc/aim/mmu_oea64.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index 680a391..e9b9a1f 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -264,7 +264,7 @@ static struct mem_region *pregions;
extern u_int phys_avail_count;
extern int regions_sz, pregions_sz;
extern int ofw_real_mode;
-static struct ofw_map translations[64];
+static struct ofw_map translations[96];
extern struct pmap ofw_pmap;
@@ -897,6 +897,9 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernele
panic("moea64_bootstrap: can't get mmu package");
if ((sz = OF_getproplen(mmu, "translations")) == -1)
panic("moea64_bootstrap: can't get ofw translation count");
+ if (size > sizeof(translations))
+ panic("moea64_bootstrap: too many ofw translations (%d)",
+ sz/sizeof(*translations));
bzero(translations, sz);
if (OF_getprop(mmu, "translations", translations, sz) == -1)
OpenPOWER on IntegriCloud