Virtual machines can easily have more than 16 option ROMs and

when that happens, we happily access our resource array out of
bounds. Make sure we stay within the MAX_ROMS limit.
While here, bump MAX_ROMS from 16 to 32 to minimize the chance
of leaving option ROMs unaccounted for.

Obtained from:	Juniper Networks, Inc.
This commit is contained in:
Marcel Moolenaar 2014-10-22 01:37:32 +00:00
parent 4a8b493f81
commit 2c383f119e

View File

@ -58,7 +58,7 @@ static struct isa_pnp_id orm_ids[] = {
{ 0, NULL },
};
#define MAX_ROMS 16
#define MAX_ROMS 32
struct orm_softc {
int rnum;
@ -97,7 +97,7 @@ orm_identify(driver_t* driver, device_t parent)
isa_set_vendorid(child, ORM_ID);
sc = device_get_softc(child);
sc->rnum = 0;
while (chunk < IOMEM_END) {
while (sc->rnum < MAX_ROMS && chunk < IOMEM_END) {
bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, chunk,
IOMEM_STEP);
rid = sc->rnum;