1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-31 16:57:10 +00:00

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
This commit is contained in:
Nathan Whitehorn 2009-11-09 14:26:23 +00:00
parent 0d384326cd
commit f90550c2d2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=199084

View File

@ -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)