svn commit: r299634 - stable/10/sys/dev/ciss

Garrett Cooper ngie at FreeBSD.org
Fri May 13 09:05:31 UTC 2016


Author: ngie
Date: Fri May 13 09:05:29 2016
New Revision: 299634
URL: https://svnweb.freebsd.org/changeset/base/299634

Log:
  MFC r298670:
  r298670 (by cem):
  
  ciss(4): Fix overrun of array
  
  The softc member 'ciss_logical' is an array of 'ciss_max_logical_bus' members.
  Most of the time it is iterated correctly.  This patch fixes the two instances
  where the driver iterated off the end of the array.
  
  CID:		1305492

Modified:
  stable/10/sys/dev/ciss/ciss.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ciss/ciss.c
==============================================================================
--- stable/10/sys/dev/ciss/ciss.c	Fri May 13 09:02:28 2016	(r299633)
+++ stable/10/sys/dev/ciss/ciss.c	Fri May 13 09:05:29 2016	(r299634)
@@ -1431,7 +1431,7 @@ ciss_init_logical(struct ciss_softc *sc)
 	goto out;
     }
 
-    for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+    for (i = 0; i < sc->ciss_max_logical_bus; i++) {
 	sc->ciss_logical[i] =
 	    malloc(sc->ciss_cfg->max_logical_supported *
 		   sizeof(struct ciss_ldrive),
@@ -2030,7 +2030,7 @@ ciss_free(struct ciss_softc *sc)
     if (sc->ciss_parent_dmat)
 	bus_dma_tag_destroy(sc->ciss_parent_dmat);
     if (sc->ciss_logical) {
-	for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+	for (i = 0; i < sc->ciss_max_logical_bus; i++) {
 	    for (j = 0; j < sc->ciss_cfg->max_logical_supported; j++) {
 		if (sc->ciss_logical[i][j].cl_ldrive)
 		    free(sc->ciss_logical[i][j].cl_ldrive, CISS_MALLOC_CLASS);


More information about the svn-src-all mailing list