Skip to content

Commit

Permalink
qlcnic: dcb: a couple off by one bugs
Browse files Browse the repository at this point in the history
The ->tc_cfg[] array has QLC_DCB_MAX_TC (8) elements so the check is
off by one.  These functions are always called with valid values though
so it doesn't affect how the code works.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Mar 3, 2014
1 parent c84a571 commit e842b06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ qlcnic_dcb_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 *prio,
!type->tc_param_valid)
return;

if (tc < 0 || (tc > QLC_DCB_MAX_TC))
if (tc < 0 || (tc >= QLC_DCB_MAX_TC))
return;

tc_cfg = &type->tc_cfg[tc];
Expand Down Expand Up @@ -843,7 +843,7 @@ static void qlcnic_dcb_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid,
!type->tc_param_valid)
return;

if (pgid < 0 || pgid > QLC_DCB_MAX_PG)
if (pgid < 0 || pgid >= QLC_DCB_MAX_PG)
return;

pgcfg = &type->pg_cfg[pgid];
Expand Down

0 comments on commit e842b06

Please sign in to comment.