Commit 232a347a authored by Scott Bardone's avatar Scott Bardone Committed by Jeff Garzik

[netdrvr] fix array overflows in Chelsio driver

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: default avatarScott Bardone <sbardone@chelsio.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent c3d7a3a4
...@@ -1021,7 +1021,7 @@ static void restart_tx_queues(struct sge *sge) ...@@ -1021,7 +1021,7 @@ static void restart_tx_queues(struct sge *sge)
if (test_and_clear_bit(nd->if_port, if (test_and_clear_bit(nd->if_port,
&sge->stopped_tx_queues) && &sge->stopped_tx_queues) &&
netif_running(nd)) { netif_running(nd)) {
sge->stats.cmdQ_restarted[3]++; sge->stats.cmdQ_restarted[2]++;
netif_wake_queue(nd); netif_wake_queue(nd);
} }
} }
...@@ -1350,7 +1350,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter, ...@@ -1350,7 +1350,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,
if (unlikely(credits < count)) { if (unlikely(credits < count)) {
netif_stop_queue(dev); netif_stop_queue(dev);
set_bit(dev->if_port, &sge->stopped_tx_queues); set_bit(dev->if_port, &sge->stopped_tx_queues);
sge->stats.cmdQ_full[3]++; sge->stats.cmdQ_full[2]++;
spin_unlock(&q->lock); spin_unlock(&q->lock);
if (!netif_queue_stopped(dev)) if (!netif_queue_stopped(dev))
CH_ERR("%s: Tx ring full while queue awake!\n", CH_ERR("%s: Tx ring full while queue awake!\n",
...@@ -1358,7 +1358,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter, ...@@ -1358,7 +1358,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
if (unlikely(credits - count < q->stop_thres)) { if (unlikely(credits - count < q->stop_thres)) {
sge->stats.cmdQ_full[3]++; sge->stats.cmdQ_full[2]++;
netif_stop_queue(dev); netif_stop_queue(dev);
set_bit(dev->if_port, &sge->stopped_tx_queues); set_bit(dev->if_port, &sge->stopped_tx_queues);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment