提交 51ce3e21 编写于 作者: C Colin Ian King 提交者: David S. Miller

net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout

Change post-decrement compare to pre-decrement to avoid an
unsigned integer wrap-around on timeout. This leads to the following
!timeout check to never to be true so -ETIMEDOUT is never returned.

Detected by CoverityScan, CID#1452623 ("Logically dead code")

Fixes: 69a60b05 ("net: phy: mdio-bcm-unimac: factor busy polling loop")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4da18741
......@@ -71,7 +71,7 @@ static int unimac_mdio_poll(void *wait_func_data)
return 0;
usleep_range(1000, 2000);
} while (timeout--);
} while (--timeout);
if (!timeout)
return -ETIMEDOUT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册