Commit 264a70b3 authored by Colin Ian King's avatar Colin Ian King Committed by Kleber Sacilotto de Souza

net: hp100: fix always-true check for link up state

BugLink: https://bugs.launchpad.net/bugs/1798617

[ Upstream commit a7f38002 ]

The operation ~(p100_inb(VG_LAN_CFG_1) & HP100_LINK_UP) returns a value
that is always non-zero and hence the wait for the link to drop always
terminates prematurely.  Fix this by using a logical not operator instead
of a bitwise complement.  This issue has been in the driver since
pre-2.6.12-rc2.

Detected by CoverityScan, CID#114157 ("Logical vs. bitwise operator")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 88543e7d
...@@ -2636,7 +2636,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin) ...@@ -2636,7 +2636,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
/* Wait for link to drop */ /* Wait for link to drop */
time = jiffies + (HZ / 10); time = jiffies + (HZ / 10);
do { do {
if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
break; break;
if (!in_interrupt()) if (!in_interrupt())
schedule_timeout_interruptible(1); schedule_timeout_interruptible(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment