* [PATCH][next] net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout
@ 2017-08-08 9:52 Colin King
2017-08-09 4:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-08-08 9:52 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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: 69a60b0579a4 ("net: phy: mdio-bcm-unimac: factor busy polling loop")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/phy/mdio-bcm-unimac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
index 89425ca48412..73c5267a11fd 100644
--- a/drivers/net/phy/mdio-bcm-unimac.c
+++ b/drivers/net/phy/mdio-bcm-unimac.c
@@ -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;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout
2017-08-08 9:52 [PATCH][next] net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout Colin King
@ 2017-08-09 4:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-09 4:07 UTC (permalink / raw)
To: colin.king; +Cc: andrew, f.fainelli, netdev, kernel-janitors, linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Tue, 8 Aug 2017 10:52:32 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: 69a60b0579a4 ("net: phy: mdio-bcm-unimac: factor busy polling loop")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-09 4:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 9:52 [PATCH][next] net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout Colin King
2017-08-09 4:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).