Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2018 08:02:11 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334137 - in head/sys/dev/cxgbe: . common
Message-ID:  <201805240802.w4O82BCG009886@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu May 24 08:02:11 2018
New Revision: 334137
URL: https://svnweb.freebsd.org/changeset/base/334137

Log:
  cxgbe(4): Fix range checks in is_etid.

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/common/common.h
==============================================================================
--- head/sys/dev/cxgbe/common/common.h	Thu May 24 07:38:46 2018	(r334136)
+++ head/sys/dev/cxgbe/common/common.h	Thu May 24 08:02:11 2018	(r334137)
@@ -358,7 +358,7 @@ struct adapter_params {
 	u_int ftid_min;
 	u_int ftid_max;
 	u_int etid_min;
-	u_int netids;
+	u_int etid_max;
 
 	unsigned int cim_la_size;
 
@@ -448,7 +448,8 @@ static inline int is_ftid(const struct adapter *sc, u_
 static inline int is_etid(const struct adapter *sc, u_int tid)
 {
 
-	return (tid >= sc->params.etid_min);
+	return (sc->params.etid_min > 0 && tid >= sc->params.etid_min &&
+	    tid <= sc->params.etid_max);
 }
 
 static inline int is_offload(const struct adapter *adap)

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Thu May 24 07:38:46 2018	(r334136)
+++ head/sys/dev/cxgbe/t4_main.c	Thu May 24 08:02:11 2018	(r334137)
@@ -3750,8 +3750,8 @@ get_params__post_init(struct adapter *sc)
 		}
 		sc->tids.etid_base = val[0];
 		sc->params.etid_min = val[0];
+		sc->params.etid_max = val[1];
 		sc->tids.netids = val[1] - val[0] + 1;
-		sc->params.netids = sc->tids.netids;
 		sc->params.eo_wr_cred = val[2];
 		sc->params.ethoffload = 1;
 	}



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