Skip to content

Commit

Permalink
[netdrvr] fix array overflows in Chelsio driver
Browse files Browse the repository at this point in the history
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]

This is a bug. The array should contain 2 elements.  Here is the fix.

Signed-off-by: Scott Bardone <sbardone@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Scott Bardone authored and Jeff Garzik committed Mar 17, 2006
1 parent c3d7a3a commit 232a347
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/chelsio/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ static void restart_tx_queues(struct sge *sge)
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);
}
}
Expand Down Expand Up @@ -1350,15 +1350,15 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,
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",
adapter->name);
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);
}
Expand Down

0 comments on commit 232a347

Please sign in to comment.