Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp630667imm; Wed, 10 Oct 2018 01:33:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV63he08fv8GRjL4d0t8Qt4kUE6z013CfiloSPMPEjPU90MAxW0Evm4Tkz06sQkDX800jXaCH X-Received: by 2002:a63:e918:: with SMTP id i24-v6mr28816811pgh.64.1539160387245; Wed, 10 Oct 2018 01:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539160387; cv=none; d=google.com; s=arc-20160816; b=Pdijxu7ANrG0NAAGal0R8SiCKtrNiLbY6nb+fJXoQ3n2OIkMooMfX8AwLl3rTSdSix C+x4CvcjHCa7RcrN09w8/6pqX4kdhqgQd+lNSNBjbQXpSZymZFkHUbIR9d0Bz4bjLtDN TWOO7MvfrIPbIH1NNK5pR6gCe8B9O0qgQ57C8TApjCFINT4J0Fx6HtrdzNNzNzLwVlsB dfwqwVgOx8vVQOvSX1VetBWHKI/aJWd+WiPw564MjMQ8Jwp6sUJKe4yQmeYBfUnbJKZ5 WZpnzKmm5fGgAVf4cM03Yx57iEPUqxo8pZOUX2x7iW3HzK23uzoD49VTZarvcn3gNn/z PmhQ== 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=sCx8Kq/FpgjyUcaf0NTijndgMQEZb4n4p1nn0jGK2l8=; b=STYdoXlnelK/QJkOBFNJFG7I+GIcfqK7lPQLl5VT3FtcOtlUMglO0B7GxagiHQl3Yh asl0ntVbXl/7XCuJJ+qRgKWR72TC9HS0wpue/y7Pu2nDDMN4M0IGPgJOPJzfmloc8314 tzay3oZxuA95b5s7K11/ZkUAKybFbmMCd0UNZojMzLTpx2SIzu3ZZjb1p1AjgZy+S/Si PYToBCRxd3q+4cbJ4/O60k50Gi6DCl6hG5nn9ib5SJxqixVJTglyI1/ndaezgukbgA+6 EcTHaWUL1lZfe2jgAxf3PFGw1oizZeObd7UKMVfID52b5iCAIltOMvc5OSo6nCBW68pY OZSQ== 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 e129-v6si14594083pgc.318.2018.10.10.01.32.52; Wed, 10 Oct 2018 01:33: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 S1727391AbeJJPvr (ORCPT + 99 others); Wed, 10 Oct 2018 11:51:47 -0400 Received: from gateway20.websitewelcome.com ([192.185.49.40]:21444 "EHLO gateway20.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeJJPvr (ORCPT ); Wed, 10 Oct 2018 11:51:47 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway20.websitewelcome.com (Postfix) with ESMTP id DAD39400DFBD0 for ; Wed, 10 Oct 2018 03:30:41 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id A9tAgFaJbRPojA9tBgXiis; Wed, 10 Oct 2018 03:30:41 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:42510 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gA9t9-000LvH-MH; Wed, 10 Oct 2018 03:30:39 -0500 Date: Wed, 10 Oct 2018 10:30:38 +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 v2 1/2] net: phy: mscc: fix signedness bug in vsc85xx_downshift_get Message-ID: 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: 1gA9t9-000LvH-MH X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:42510 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 11 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") Reviewed-by: Quentin Schulz Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Add Quentin's Reviewed-by to the commit log. 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