netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yuval Mintz <Yuval.Mintz@cavium.com>
Cc: Ariel Elior <Ariel.Elior@cavium.com>,
	everest-linux-l2@cavium.com, netdev@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH net-next] qed: Fix an off by one bug
Date: Wed, 14 Jun 2017 12:10:10 +0300	[thread overview]
Message-ID: <20170614091009.GA29394@elgon.mountain> (raw)

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

             reply	other threads:[~2017-06-14  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  9:10 Dan Carpenter [this message]
2017-06-14  9:21 ` [PATCH net-next] qed: Fix an off by one bug Mintz, Yuval
2017-06-14 19:20 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170614091009.GA29394@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=Ariel.Elior@cavium.com \
    --cc=Yuval.Mintz@cavium.com \
    --cc=everest-linux-l2@cavium.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).