Netdev List
 help / color / mirror / Atom feed
* [patch] qlcnic: dcb: a couple off by one bugs
@ 2014-03-01 13:54 Dan Carpenter
  2014-03-03  9:12 ` Sucheta Chakraborty
  2014-03-03 20:38 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-03-01 13:54 UTC (permalink / raw)
  To: Shahed Shaikh; +Cc: Dept-HSGLinuxNICDev, netdev, kernel-janitors

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>

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
index 77f1bce432d2..7d4f54912bad 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
@@ -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];

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [patch] qlcnic: dcb: a couple off by one bugs
  2014-03-01 13:54 [patch] qlcnic: dcb: a couple off by one bugs Dan Carpenter
@ 2014-03-03  9:12 ` Sucheta Chakraborty
  2014-03-03 20:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sucheta Chakraborty @ 2014-03-03  9:12 UTC (permalink / raw)
  To: Dan Carpenter, Shahed Shaikh
  Cc: Dept-HSG Linux NIC Dev, kernel-janitors@vger.kernel.org, netdev

> -----Original Message-----
> From: dept_hsg_linux_nic_dev-bounces@qlclistserver.qlogic.com
> [mailto:dept_hsg_linux_nic_dev-bounces@qlclistserver.qlogic.com] On
> Behalf Of Dan Carpenter
> Sent: Saturday, March 01, 2014 7:25 PM
> To: Shahed Shaikh
> Cc: Dept-HSG Linux NIC Dev; kernel-janitors@vger.kernel.org; netdev
> Subject: [patch] 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
> index 77f1bce432d2..7d4f54912bad 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
> @@ -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];

Acked-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] qlcnic: dcb: a couple off by one bugs
  2014-03-01 13:54 [patch] qlcnic: dcb: a couple off by one bugs Dan Carpenter
  2014-03-03  9:12 ` Sucheta Chakraborty
@ 2014-03-03 20:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-03-03 20:38 UTC (permalink / raw)
  To: dan.carpenter; +Cc: shahed.shaikh, Dept-HSGLinuxNICDev, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sat, 1 Mar 2014 16:54:36 +0300

> 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>

Applied, thanks a lot Dan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-03 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-01 13:54 [patch] qlcnic: dcb: a couple off by one bugs Dan Carpenter
2014-03-03  9:12 ` Sucheta Chakraborty
2014-03-03 20:38 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox