cxgb4vf: Fix off-by-one error checking for the end of the mailbox delay array
authorCasey Leedom <leedom@chelsio.com>
Tue, 20 Jul 2010 00:51:46 +0000 (17:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jul 2010 19:42:42 +0000 (12:42 -0700)
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>
drivers/net/cxgb4vf/t4vf_hw.c

index 1ef252864b9cd34f6bb31c1e388328cee39a4966..ea1c123f0cb4b9e44eeac857920622aa9d51e8b5 100644 (file)
@@ -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