Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4303908pxj; Tue, 8 Jun 2021 11:02:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdnR9xANMlovH5ojWnKJUJLVFRgNLJnTwgXzMtrumSiExhK5ATzfPx+dyBywe1xhzYwcOE X-Received: by 2002:aa7:d3ca:: with SMTP id o10mr27195686edr.197.1623175326839; Tue, 08 Jun 2021 11:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623175326; cv=none; d=google.com; s=arc-20160816; b=lhM8m10JZgJ0rAYBBj8Mkdrizgjwq1IXv2wHmTq7DAg2Esp8wJqqYdXJQBFZlf2Mw8 C7A7saMFvgLzxa4rOdm6toaZWfUoAbZ6xXLPbQznPlA4DqGiz59UkvRqxiXTNWxF7EVD YiAc8q4Kz8ypCCU4p4f7aKjXseAYH2I7FfuoWpUQ8dzy+i52bY0gT6yX3dtZl8zrv09l SEkYuye2ctivkWhslai1fxI62T8y+hbtsYVAMUN9ysF7dP2eBcKpWa7d9MB45fApGmwG W8VOQUNT2qxZID6Uu4RNCrBvXzyrHqipmg1XEnF1KUuXdYqiPS57Rz9CHc7hg2ktWEqc cRxQ== 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=eM60vWu8/GzD4e80jG/1p5WjTdwEqVdpRSHoNwz7sTQ=; b=Dqiicw8SaDGBufzcFltRsRwftNctOodTfaM/SuXolCKuUcA2ZOg1sRoXqlclFudEcO RX230ogiw4I8obc7cfUfiuZQSbgx7yWidTzL1qN33RzYrWV+uxXBZzfOC8marIDzek5O 0hcDgtvFG/xK3DlII6WSOSH9xpdrDPmK/XRfW4zI93NC063OELAZ1RlbEfTdOp7kslK+ 8AxBFNvTz/yM8ZVatMVO6o96BC7fog2o+v9TYQTWCymE7Bk+lCRV5UjNJDOTetK9Sg5W OE6WDzyimHGPbxuCiVDSdva6KfYEqRyz8xr2nqsP3yhsntAAIfi/kFXFmcMYXlFgy8Dr +EXQ== 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 f23si147821edv.591.2021.06.08.11.01.40; Tue, 08 Jun 2021 11:02:06 -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 S233991AbhFHSAY (ORCPT + 99 others); Tue, 8 Jun 2021 14:00:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233983AbhFHSAX (ORCPT ); Tue, 8 Jun 2021 14:00:23 -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 01851C061787 for ; Tue, 8 Jun 2021 10:58:30 -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 1lqfzZ-0006nr-Gj; Tue, 08 Jun 2021 19:58:21 +0200 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1lqfzY-0003Cp-AE; Tue, 08 Jun 2021 19:58:20 +0200 Date: Tue, 8 Jun 2021 19:58:20 +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 1/2][next] net: usb: asix: Fix less than zero comparison of a u16 Message-ID: <20210608175820.fxeaotpomtsywwfh@pengutronix.de> References: <20210608152249.160333-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210608152249.160333-1-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: 19:57:08 up 188 days, 8:03, 50 users, load average: 0.02, 0.02, 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:48PM +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: e532a096be0e ("net: usb: asix: ax88772: add phylib support") > Signed-off-by: Colin Ian King > --- > drivers/net/usb/asix_devices.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c > index 57dafb3262d9..211c5a87eb15 100644 > --- a/drivers/net/usb/asix_devices.c > +++ b/drivers/net/usb/asix_devices.c > @@ -704,9 +704,10 @@ static int ax88772_init_phy(struct usbnet *dev) > struct asix_common_private *priv = dev->driver_priv; > int ret; > > - priv->phy_addr = asix_read_phy_addr(dev, true); > - if (priv->phy_addr < 0) > + ret = asix_read_phy_addr(dev, true); > + if (ret < 0) > return priv->phy_addr; please add new line here > + priv->phy_addr = ret; > > snprintf(priv->phy_name, sizeof(priv->phy_name), PHY_ID_FMT, > priv->mdio->id, priv->phy_addr); > -- > 2.31.1 > Thank you! Reviewed-by: Oleksij Rempel -- 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 |