From: Scott Bardone <sbardone@chelsio.com>
To: Adrian Bunk <bunk@stusta.de>
Cc: maintainers@chelsio.com, jgarzik@pobox.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: drivers/net/chelsio/sge.c: two array overflows
Date: Mon, 13 Mar 2006 11:31:07 -0800 [thread overview]
Message-ID: <4415C87B.90107@chelsio.com> (raw)
In-Reply-To: <20060311013720.GG21864@stusta.de>
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]
Adrian,
This is a bug. The array should contain 2 elements.
Attached is a patch which fixes it.
Thanks.
Signed-off-by: Scott Bardone <sbardone@chelsio.com>
Adrian Bunk wrote:
> The Coverity checker spotted the following two array overflows in
> drivers/net/chelsio/sge.c (in both cases, the arrays contain 3 elements):
>
> <-- snip -->
>
> ...
> static void restart_tx_queues(struct sge *sge)
> {
> ...
> sge->stats.cmdQ_restarted[3]++;
> ...
> static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,
> unsigned int qid, struct net_device *dev)
> {
> ...
> sge->stats.cmdQ_full[3]++;
> ...
>
> <-- snip -->
>
>
> cu
> Adrian
>
[-- Attachment #2: sge.patch --]
[-- Type: text/x-patch, Size: 907 bytes --]
--- sge.c 2006-02-17 14:23:45.000000000 -0800
+++ sge.fix.c 2006-03-13 10:51:24.000000000 -0800
@@ -1021,7 +1021,7 @@
if (test_and_clear_bit(nd->if_port,
&sge->stopped_tx_queues) &&
netif_running(nd)) {
- sge->stats.cmdQ_restarted[3]++;
+ sge->stats.cmdQ_restarted[2]++;
netif_wake_queue(nd);
}
}
@@ -1350,7 +1350,7 @@
if (unlikely(credits < count)) {
netif_stop_queue(dev);
set_bit(dev->if_port, &sge->stopped_tx_queues);
- sge->stats.cmdQ_full[3]++;
+ sge->stats.cmdQ_full[2]++;
spin_unlock(&q->lock);
if (!netif_queue_stopped(dev))
CH_ERR("%s: Tx ring full while queue awake!\n",
@@ -1358,7 +1358,7 @@
return NETDEV_TX_BUSY;
}
if (unlikely(credits - count < q->stop_thres)) {
- sge->stats.cmdQ_full[3]++;
+ sge->stats.cmdQ_full[2]++;
netif_stop_queue(dev);
set_bit(dev->if_port, &sge->stopped_tx_queues);
}
next prev parent reply other threads:[~2006-03-13 19:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-11 1:37 drivers/net/chelsio/sge.c: two array overflows Adrian Bunk
2006-03-13 19:31 ` Scott Bardone [this message]
2006-03-17 0:21 ` Jeff Garzik
2006-03-17 12:19 ` Hans-Peter Jansen
2006-03-17 18:46 ` Scott Bardone
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=4415C87B.90107@chelsio.com \
--to=sbardone@chelsio.com \
--cc=bunk@stusta.de \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maintainers@chelsio.com \
--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).