diff options
author | roel kluin <roel.kluin@gmail.com> | 2009-12-27 11:22:08 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-03 21:42:50 -0800 |
commit | c064efca9211d12bb9e6de8718fc39884eb883f2 (patch) | |
tree | 08bbd1373039d5a3466e72a4d079ee63af14a076 /drivers/net/usb | |
parent | ce739b473ce12d5ef067b39b8637bfd2b2174a15 (diff) | |
download | blackbird-op-linux-c064efca9211d12bb9e6de8718fc39884eb883f2.tar.gz blackbird-op-linux-c064efca9211d12bb9e6de8718fc39884eb883f2.zip |
usbnet: test off by one
With `while (i++ < MII_TIMEOUT)' i reaches MII_TIMEOUT + 1 after the loop
This is probably unlikely a problem in practice.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/rtl8150.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index f14d225404da..fd19db0d2504 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -270,7 +270,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) get_registers(dev, PHYCNT, 1, data); } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); - if (i < MII_TIMEOUT) { + if (i <= MII_TIMEOUT) { get_registers(dev, PHYDAT, 2, data); *reg = data[0] | (data[1] << 8); return 0; @@ -295,7 +295,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg) get_registers(dev, PHYCNT, 1, data); } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); - if (i < MII_TIMEOUT) + if (i <= MII_TIMEOUT) return 0; else return 1; |