cxgbe(4): Fix range checks in is_etid.

This commit is contained in:
Navdeep Parhar 2018-05-24 08:02:11 +00:00
parent a6a8ff351d
commit 1dd95f641e
2 changed files with 4 additions and 3 deletions

View File

@ -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_int tid)
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)

View File

@ -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;
}