Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp56225imm; Tue, 9 Oct 2018 13:45:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV60tTHQqCo0UpUui6GFXld+JDmToSPA/lGqcWJuHJUrk5KmnOGozcTZfzfc73bF43/yA0YWT X-Received: by 2002:a62:c42:: with SMTP id u63-v6mr31929455pfi.43.1539117907693; Tue, 09 Oct 2018 13:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539117907; cv=none; d=google.com; s=arc-20160816; b=plEHepeRRau8Ux2YLqf2iKPk3zsdHSnY7t0lMlWVgU8D0p6mhPLNeUCGdRgKm1jiRd azy5adBhhvNUxcp7OkxvD4xVY3nHV3YhxJfN54uB8HJmYCT139ozCs+8f0WC6o918cUp awkEymjSIrtCPbztYMTQg7pTgaxLkRpy7g5VqhDZ4RJEnrMJLvTvppN6ffEEn15fB56+ 8PmVWSG7pC3uR8F0xf7WxfDWClOxYdjiPgLw0iKzBqK9ZhhDdeFm2YJwgUeMRLGglzgQ fHw7gUb1JJZQ5Wwoc5eclto/pcOr0ljfXV6C0WMT2Djw2UiK+MF3WrMBIeq9W52PixHx t4Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OZFoQXdf6rPikt11eMIjHziQVrNBMjOI5PqsemLY0ZM=; b=Z30mOVqEjnJv9Zf0MSsmu/LCvOy8ggv7VosHTk0Pmq1Z1+SPjhyr8ZRu1atAb9XyAO USJInQIVNS80Xao8U4pwom7fMKKkxeneyhVmFdJ42fnJGgt9eaP/+ZijyokIlW7Fbwgt SVNztJtOXpYUuC8ecZS47TlO/5TRZwVERu0YaJnu3+djZM0ZMk+isme6fAkLS33KAEWO XhPWZ61yH6rYZ9G7Mzkci5/mysN320WhaqAfjaNkhOtSff+OereW5FEoc3AApzG9pt+V 9oJtVMbli55HWFlKZPur5n+MrLL46ZuZXA23wbvaLIUHN2CErswS+zKXEo57zrrQ+IvR PX7w== 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 p21-v6si22420595pgi.199.2018.10.09.13.44.47; Tue, 09 Oct 2018 13:45:07 -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 S1727749AbeJJC5b (ORCPT + 99 others); Tue, 9 Oct 2018 22:57:31 -0400 Received: from gateway34.websitewelcome.com ([192.185.149.105]:40471 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbeJJC5a (ORCPT ); Tue, 9 Oct 2018 22:57:30 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 29FD0301B6 for ; Tue, 9 Oct 2018 14:38:59 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 9xq2gVsFLBcCX9xqEgojYe; Tue, 09 Oct 2018 14:38:58 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:39204 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1g9xq0-001vWP-Dv; Tue, 09 Oct 2018 14:38:36 -0500 Date: Tue, 9 Oct 2018 21:38:33 +0200 From: "Gustavo A. R. Silva" To: linux-kernel@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Quentin Schulz , "Gustavo A. R. Silva" Subject: [PATCH net-next 1/2] net: phy: mscc: fix signedness bug in vsc85xx_downshift_get Message-ID: <84a75d5e5f7717108feeda49b69b57ecbf361b9c.1539113472.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 109.24.154.57 X-Source-L: No X-Exim-ID: 1g9xq0-001vWP-Dv X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:39204 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 15 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the error handling for the call to function phy_read_paged() doesn't work because *reg_val* is of type u16 (16 bits, unsigned), which makes it impossible for it to hold a value less than 0. Fix this by changing the type of variable *reg_val* to int. Addresses-Coverity-ID: 1473970 ("Unsigned compared against 0") Fixes: 6a0bfbbe20b0 ("net: phy: mscc: migrate to phy_select/restore_page functions") Signed-off-by: Gustavo A. R. Silva --- drivers/net/phy/mscc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index bffe077..bff56c3 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -522,7 +522,7 @@ static int vsc85xx_mdix_set(struct phy_device *phydev, u8 mdix) static int vsc85xx_downshift_get(struct phy_device *phydev, u8 *count) { - u16 reg_val; + int reg_val; reg_val = phy_read_paged(phydev, MSCC_PHY_PAGE_EXTENDED, MSCC_PHY_ACTIPHY_CNTL); -- 2.7.4