Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4312690pxj; Tue, 8 Jun 2021 11:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxpnb8V6m1hIUT8qxMIpqy2a3w26HghPbYhmj+Zbrmc78W4jjTWjM1nS+p82EwtHruyAvs X-Received: by 2002:a17:906:9d05:: with SMTP id fn5mr24585814ejc.133.1623175991606; Tue, 08 Jun 2021 11:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623175991; cv=none; d=google.com; s=arc-20160816; b=vPPAeFhB3+i5Lh2mQ8g3yGtbfOwheysune73QClN9ykDNm90IDBuMF2oLYq9Kr+F7x 3jYnOu2VabaCLkYeVBH5mT1nKw/NEs4cy+8KN2Kupn8c9Gqjcfq/gR8IeA0jmX4cilkb 0pbLLc/OC57LiIbcVvqP20SEKbRQL5OZALrOWPBbVn8+41ekD6BSGsf1j0I92cEOFUm1 T7lJWfGcgA1Pq6lWuyCCnv/Y3+kkFiT9zuaaD3cI2o7Detf8zvpkUQPe0oL5bJ2XjA8N FKRvCfGSHYv/5kQMboiptF6lXtAfcknG58aBHaHUmV7D1CGWVGdiIDoocgOeEpKZdv3l vQ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=TAdRJnI2qhRBnXEoklbgbweU5bcPvpuomCgwiUTJBp4=; b=fXRqDU4JTzTrwlXAzBmbUvkweD5zm12lTIVIPcSXM6pF27C5wPbQmYVQo8OBqBaUN/ tenfWJ4Ikr3epS4hOAUV4u1HSfDHBGmtrjJBBPLCi75LlHiFHktj7JdmprQI8jt9bfmf gRX8a1cTQMJPYxMXmu0l2mwuXucpTgvOquqpIHLaRVnEzLvRfbmbV2vAYk55YBvOLWkB 4NPN3cNBhWsLlaXEXWwZPkySAh+ie+98EtHRAo+dvCaZfqJMZsnRRvlZbY7XSa4z2N7t Ny7YIjoOqoKsmiJnMJJL7LotThE6MKVMPrg4Grrqdhv70CDHtzL4TFQqnwuCSnu8Eiym /F/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si330455eds.105.2021.06.08.11.12.47; Tue, 08 Jun 2021 11:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232785AbhFHSNc (ORCPT + 99 others); Tue, 8 Jun 2021 14:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233603AbhFHSNa (ORCPT ); Tue, 8 Jun 2021 14:13:30 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19C89C061574 for ; Tue, 8 Jun 2021 11:11:37 -0700 (PDT) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqgCH-0000FC-QN; Tue, 08 Jun 2021 20:11:29 +0200 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1lqgCH-000412-6e; Tue, 08 Jun 2021 20:11:29 +0200 Date: Tue, 8 Jun 2021 20:11:29 +0200 From: Oleksij Rempel To: Colin King Cc: "David S . Miller" , Jakub Kicinski , Oleksij Rempel , linux-usb@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2][next] net: usb: asix: ax88772: net: Fix less than zero comparison of a u16 Message-ID: <20210608181129.7mnuba6dcaemslul@pengutronix.de> References: <20210608152249.160333-1-colin.king@canonical.com> <20210608152249.160333-2-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210608152249.160333-2-colin.king@canonical.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 20:00:59 up 188 days, 8:07, 50 users, load average: 0.04, 0.03, 0.00 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 08, 2021 at 04:22:49PM +0100, Colin King wrote: > From: Colin Ian King > > The comparison of the u16 priv->phy_addr < 0 is always false because > phy_addr is unsigned. Fix this by assigning the return from the call > to function asix_read_phy_addr to int ret and using this for the > less than zero error check comparison. > > Addresses-Coverity: ("Unsigned compared against 0") > Fixes: 7e88b11a862a ("net: usb: asix: refactor asix_read_phy_addr() and handle errors on return") Here is wrong Fixes tag. This assignment was bogus before this patch. > Signed-off-by: Colin Ian King > --- > drivers/net/usb/ax88172a.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c > index 2e2081346740..e24773bb9398 100644 > --- a/drivers/net/usb/ax88172a.c > +++ b/drivers/net/usb/ax88172a.c > @@ -205,7 +205,8 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) > goto free; > } > > - priv->phy_addr = asix_read_phy_addr(dev, priv->use_embdphy); > + ret = asix_read_phy_addr(dev, priv->use_embdphy); > + priv->phy_addr = ret; Ah.. it is same bug in different color :) You probably wonted to do: if (ret < 0) goto free; priv->phy_addr = ret; > if (priv->phy_addr < 0) { > ret = priv->phy_addr; > goto free; > -- > 2.31.1 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |