Skip to content

Commit

Permalink
cxgb4vf: Fix off-by-one error checking for the end of the mailbox del…
Browse files Browse the repository at this point in the history
…ay array

Fix off-by-one error in checking for the end of the mailbox response delay
array.  We ended up walking off the end and, if we were unlucky, we'd end up
pulling in a 0 and never terminate the mailbox response delay loop ...

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Casey Leedom authored and David S. Miller committed Jul 20, 2010
1 parent e7c3815 commit 024e629
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/cxgb4vf/t4vf_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
for (i = 0; i < 500; i += ms) {
if (sleep_ok) {
ms = delay[delay_idx];
if (delay_idx < ARRAY_SIZE(delay))
if (delay_idx < ARRAY_SIZE(delay) - 1)
delay_idx++;
msleep(ms);
} else
Expand Down

0 comments on commit 024e629

Please sign in to comment.