From: Casey Leedom Date: Tue, 20 Jul 2010 00:51:46 +0000 (-0700) Subject: cxgb4vf: Fix off-by-one error checking for the end of the mailbox delay array X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=024e6293f959dc86827284bc1d7c93c8baed1ec6;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git cxgb4vf: Fix off-by-one error checking for the end of the mailbox delay 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c index 1ef252864b9..ea1c123f0cb 100644 --- a/drivers/net/cxgb4vf/t4vf_hw.c +++ b/drivers/net/cxgb4vf/t4vf_hw.c @@ -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