From owner-svn-src-all@freebsd.org Wed Apr 20 01:17:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06EA0B1493C; Wed, 20 Apr 2016 01:17:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 CCCF3130E; Wed, 20 Apr 2016 01:17:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3K1HJKa025116; Wed, 20 Apr 2016 01:17:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3K1HJGl025115; Wed, 20 Apr 2016 01:17:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201604200117.u3K1HJGl025115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Apr 2016 01:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298322 - head/sys/dev/nctgpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 01:17:20 -0000 Author: cem Date: Wed Apr 20 01:17:18 2016 New Revision: 298322 URL: https://svnweb.freebsd.org/changeset/base/298322 Log: nctgpio(4): Don't index past the end of sc->pins array This driver thinks that the NCT_MAX_PIN index is a valid index in a few places (nct_attach() for-loop, as well as NCT_IS_VALID_PIN()). Allocate room for NCT_MAX_PIN as an index, that is, NCT_MAX_PIN + 1 elements. Reported by: Coverity CIDs: 1353806, 1353807, 1353808, 1353809, 1353810 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/nctgpio/nctgpio.c Modified: head/sys/dev/nctgpio/nctgpio.c ============================================================================== --- head/sys/dev/nctgpio/nctgpio.c Wed Apr 20 01:10:07 2016 (r298321) +++ head/sys/dev/nctgpio/nctgpio.c Wed Apr 20 01:17:18 2016 (r298322) @@ -101,7 +101,7 @@ struct nct_softc { struct mtx mtx; struct resource *portres; int rid; - struct gpio_pin pins[NCT_MAX_PIN]; + struct gpio_pin pins[NCT_MAX_PIN + 1]; }; #define GPIO_LOCK_INIT(_sc) mtx_init(&(_sc)->mtx, \