netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] qed: Fix an off by one bug
@ 2017-06-14  9:10 Dan Carpenter
  2017-06-14  9:21 ` Mintz, Yuval
  2017-06-14 19:20 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-06-14  9:10 UTC (permalink / raw)
  To: Yuval Mintz; +Cc: Ariel Elior, everest-linux-l2, netdev, kernel-janitors

The p_l2_info->pp_qid_usage[] array has "p_l2_info->queues" elements so
the > here should be a >= or we write beyond the end of the array.

Fixes: bbe3f233ec5e ("qed: Assign a unique per-queue index to queue-cid")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
index cb8b05dbfc6e..e57699bfbdfa 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
@@ -161,7 +161,7 @@ static bool qed_eth_queue_qid_usage_add(struct qed_hwfn *p_hwfn,
 
 	mutex_lock(&p_l2_info->lock);
 
-	if (queue_id > p_l2_info->queues) {
+	if (queue_id >= p_l2_info->queues) {
 		DP_NOTICE(p_hwfn,
 			  "Requested to increase usage for qzone %04x out of %08x\n",
 			  queue_id, p_l2_info->queues);

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

* RE: [PATCH net-next] qed: Fix an off by one bug
  2017-06-14  9:10 [PATCH net-next] qed: Fix an off by one bug Dan Carpenter
@ 2017-06-14  9:21 ` Mintz, Yuval
  2017-06-14 19:20 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mintz, Yuval @ 2017-06-14  9:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org

> The p_l2_info->pp_qid_usage[] array has "p_l2_info->queues" elements so
> the > here should be a >= or we write beyond the end of the array.
> 
> Fixes: bbe3f233ec5e ("qed: Assign a unique per-queue index to queue-cid")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

While it's a theoretical fix [as check is defensive; the queue-id was supposed
to be validated before reaching this part], it's still the right. Thanks Dan.

Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>

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

* Re: [PATCH net-next] qed: Fix an off by one bug
  2017-06-14  9:10 [PATCH net-next] qed: Fix an off by one bug Dan Carpenter
  2017-06-14  9:21 ` Mintz, Yuval
@ 2017-06-14 19:20 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-06-14 19:20 UTC (permalink / raw)
  To: dan.carpenter
  Cc: Yuval.Mintz, Ariel.Elior, everest-linux-l2, netdev,
	kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 14 Jun 2017 12:10:10 +0300

> The p_l2_info->pp_qid_usage[] array has "p_l2_info->queues" elements so
> the > here should be a >= or we write beyond the end of the array.
> 
> Fixes: bbe3f233ec5e ("qed: Assign a unique per-queue index to queue-cid")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2017-06-14 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14  9:10 [PATCH net-next] qed: Fix an off by one bug Dan Carpenter
2017-06-14  9:21 ` Mintz, Yuval
2017-06-14 19:20 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).