Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4600506pxj; Tue, 8 Jun 2021 19:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycejz1T4N/2T7aP/rm4xEGR09ZJKo5GXP5Rqt4v3mWYPMPQLs+f3E8GypopqOfzj56EDvj X-Received: by 2002:a17:906:2459:: with SMTP id a25mr25731097ejb.306.1623205325222; Tue, 08 Jun 2021 19:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623205325; cv=none; d=google.com; s=arc-20160816; b=VvbOb43oGzLrVKjMLnQYxFj9Q6G9xVjiOEui+N2hMp6+oPky3z/kqxKETfOsfAr5VN h0EarGas3+5EK/Xhje9rjH5Mwc/QDeRaT4LEwRwpLOIH9afn3K9brOIAapmJ3QXVijNP va6AYyUBTHoh3NykeN2SILPa42/REVuuMQLCjL/8/hGJBH8b+lhe5n45Sheb6hIPrTwJ hOC1qOFZg2eD1dmikNHv1jk4LctJV7nQnyg1mJfYWvz5KEwUj9IxjcgHC48b/CjaSp3d V8h2s3SCD1qN/P7/3Q6XXHySxz5KHcB93J9MApwfD5CWBXMEpzJdNUastI9vDbMOXgeT R/zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=YNYjUuh3H/tYjtTK0uJqlvqo3P5AARQ6ptC8S/vqwfk=; b=lgDSNCTmAwwGQXxsg2UOzZMBAKWAwb2R3hrJUd2PgtYVl+xF2nnUnA2Spw0jaj+QcX 7Bd3eAc1PYDRxByQzo5jIOhGLrEZKRVnES+1rInHCvu65nkAS3kcRb6ZPkYLIWRvbIcw 4wZ1Hm+B7dDRHTKIdmMIVciqRoQjhOIkSyAmhoP0Pi+5fHMgq7ef2e4tIr9Nr0Ih5Vr2 mocEeIt7vR13/7NztFYc98op/CIyuQUAiBJX99loZckYAzAKuQzide7x2vC/RSKPYzmA YQQmJORNfYJxW3o6yFZmOuIvyZOzJ2EBmIstpEz67YrreKf4HhjCzHHk1ahfdYBCiluh iUjg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si1089239edc.226.2021.06.08.19.21.32; Tue, 08 Jun 2021 19:22:05 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233783AbhFHPHa (ORCPT + 99 others); Tue, 8 Jun 2021 11:07:30 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37612 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233354AbhFHPH3 (ORCPT ); Tue, 8 Jun 2021 11:07:29 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lqdIM-00044T-OR; Tue, 08 Jun 2021 15:05:34 +0000 Subject: NAK: [PATCH][next] net: usb: asix: ax88772: Fix less than zero comparison of a u16 From: Colin Ian King To: "David S . Miller" , Jakub Kicinski , Oleksij Rempel , linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210608145823.159467-1-colin.king@canonical.com> Message-ID: <26127b07-6f9e-12bb-6d2e-edf6819c08f1@canonical.com> Date: Tue, 8 Jun 2021 16:05:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210608145823.159467-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/2021 15:58, 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; > + priv->phy_addr = ret; > > snprintf(priv->phy_name, sizeof(priv->phy_name), PHY_ID_FMT, > priv->mdio->id, priv->phy_addr); > Wrong commit message. I'll send a new fix. Colin