Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Apr 2016 01:17:19 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298322 - head/sys/dev/nctgpio
Message-ID:  <201604200117.u3K1HJGl025115@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,		\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604200117.u3K1HJGl025115>