From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:37:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8642B302; Wed, 22 Oct 2014 01:37:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7244BC9B; Wed, 22 Oct 2014 01:37:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1bXVg023210; Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1bXuh023209; Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410220137.s9M1bXuh023209@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 22 Oct 2014 01:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273446 - head/sys/x86/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:37:33 -0000 Author: marcel Date: Wed Oct 22 01:37:32 2014 New Revision: 273446 URL: https://svnweb.freebsd.org/changeset/base/273446 Log: 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. Modified: head/sys/x86/isa/orm.c Modified: head/sys/x86/isa/orm.c ============================================================================== --- head/sys/x86/isa/orm.c Wed Oct 22 01:35:30 2014 (r273445) +++ head/sys/x86/isa/orm.c Wed Oct 22 01:37:32 2014 (r273446) @@ -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 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;