Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1768832imm; Thu, 27 Sep 2018 02:07:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV62ES8Aalcl/+uJaSIi6jjNB0KRuRpPUQCiyZ3Gl1HOfTcCiEPFniTqPhyma54I46yUeCp/w X-Received: by 2002:a62:46c8:: with SMTP id o69-v6mr10394473pfi.21.1538039278597; Thu, 27 Sep 2018 02:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039278; cv=none; d=google.com; s=arc-20160816; b=MBaRWRlKpMsK7Xi1ezysuwHWmScj3vHK99B71pHsxv2Z3YMkk4/NXdj+mOvndSUluz 3nWMF7FxLdgrqcsFRcaBUsDzwyOQ+a027+0eCCyovFHY6vp3U28KGmZHbRDNOZic/fbO vSdYLAd9vnRLlHjzdA5mzYRpxSRN2NEOSLHGpXM8wHMesnEgs/xHYJqdHZhAEJrJbxiZ cuNqZSIw4/GT/DXVktO8pMkr9J778y8apHjM6nDxauTQOFIjYVWE9HTFZjOOPONo71oV ylB0uLRqSoNKnAJWuSUwXA8ED4fnPla1OpENgIdgsFTgN3Jfbu5O6xVNsDCTDLoA3d8X 1AYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=pQ3WhCJe2IhO4Sxlal2VbmaL58MKSa8rn1SNODBRRbo=; b=uOVin9RdPUhRiDEu91Xb7+U2jhsWEybr8Tx5ugTtlqxyyhUYZVHK3oKLuEARYeR6wR 8foMo4PetspMd5icP4x8mkzTee9eZICSI6NjVBCT7ywmqiZdJaTKTmWv1Z8H/l9EoUUF AZPbK0lJJOOaLfI9iepKLw8oS/E8TBsKeJyh62hK/JwWl6jHS0fc38/7++E4QgJbdagD Peucsd+/RUJrF7rOCiPf8b77uGPBS8/zSOPBH0eP8PQC32TZX/m26EBTyZw28Vtsgj6I BmuTSafV4yYEHfLN1V7lZqa4hw2MiJ8N65h9YOU7Df/uhu6FzXCotnUJdHFNCApj6tZn 8jcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a143-v6si1548871pfd.241.2018.09.27.02.07.43; Thu, 27 Sep 2018 02:07:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727454AbeI0PYf (ORCPT + 99 others); Thu, 27 Sep 2018 11:24:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54730 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbeI0PYf (ORCPT ); Thu, 27 Sep 2018 11:24:35 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5B9B210C8; Thu, 27 Sep 2018 09:07:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , "David S. Miller" Subject: [PATCH 4.18 04/88] net: hp100: fix always-true check for link up state Date: Thu, 27 Sep 2018 11:02:45 +0200 Message-Id: <20180927090301.125462485@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King [ Upstream commit a7f38002fb69b44f8fc622ecb838665d0b8666af ] 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: Colin Ian King Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hp/hp100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c @@ -2634,7 +2634,7 @@ static int hp100_login_to_vg_hub(struct /* Wait for link to drop */ time = jiffies + (HZ / 10); do { - if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) + if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) break; if (!in_interrupt()) schedule_timeout_interruptible(1);