qlcnic: dcb: a couple off by one bugs
PATCH 1/1 qlcnic: dcb: a couple off by one bugs
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.
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +2 -2
@@ -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];
@@ -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];
Quoted 39 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dan Carpenter
Sent: Saturday, March 01, 2014 7:25 PM
To: Shahed Shaikh
Cc: Dept-HSG Linux NIC Dev; [email protected]; netdev
Subject: [patch] qlcnic: dcb: a couple off by one bugsThe ->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 <[email protected]>drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +1
-1@@ -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 ;drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +1
-1tc_cfg = &type->tc_cfg[tc];@@ -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 ;
Quoted 1 line
pgcfg = &type->pg_cfg[pgid];
From: Dan Carpenter <[email protected]>
Date: Sat, 1 Mar 2014 16:54:36 +0300
Quoted 5 lines
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 <[email protected]>
Applied, thanks a lot Dan.