Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3150651pxa; Tue, 18 Aug 2020 07:53:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvHbcaBV3zw3ha8U1d16OmQNsBqORyteuVBpGO1Z/HTcB4Vg5keMWR9ahXri8Y1WANVwz/ X-Received: by 2002:a50:d9c6:: with SMTP id x6mr20776524edj.56.1597762396318; Tue, 18 Aug 2020 07:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597762396; cv=none; d=google.com; s=arc-20160816; b=zaZmn/YEzQAnc8bzyDkagQeclaYaaSJs3jXItdxe+K93p32gc2KS+gua/uAx100SFf LgR2wdwU96tLMWS/aZWDnzCGLvRmBk2zJtdaQBTaJRl/NtgSp6EM5Et9e03bTQOhZQMA mBCENGfmcR9NZ8SoJOtyshyXmm/YNZwKIhk1E2EGN7lbkPMXPp1GEp0gJbtQ2R/8OJWC IUsRtO4Ll2JbVJ5s1L8X0ykJaZVae6U33qO0ZYAkrr/37CmqaJy/WaSgFchXv4N+ghOB R+/qn3SIYWtTXsYCb6CH80Ani3+tpTe9lGPZWiC/jY8e/eiVFVPf7v7ZpfTNBHS3rxH0 DDQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=vIkROMsKawYsr7hA6qmd19sz0lO/8u/f1AeMeZzr/4E=; b=y7r0uCur6yAgl8xxwZt9UbYsXKeMVaMVG0TGkl1PsDUurCz0MBlqdPtV5eD658jbZS s07CyLReUmewGEsSMYzhScq+t0JV27uZvQx8i8Rmz5O77V62nOvlJfYkQa3DUbEih+rf 50n1D5pEn8/Sg02kHBCOKsIFXOF1QdWeuf/2YN/1FY75iFqawNTI11mVWweq6uol2siQ zXGqCd7n3Edn2KIeno+vswNkDdy5kgqHfOLTY/b2sr9d251Rime1DDuy2ffBftwy8F19 WBmkiFQ06xU7mCTVz4/iPHeUaOzv6A6XLjMb5N5qAdlw70uSg0GLQITHr6Cgi90DCW8C B4yA== 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 n5si13333858ejc.171.2020.08.18.07.52.51; Tue, 18 Aug 2020 07:53:16 -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 S1727034AbgHROwK (ORCPT + 99 others); Tue, 18 Aug 2020 10:52:10 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:59024 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbgHROwI (ORCPT ); Tue, 18 Aug 2020 10:52:08 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4BWDQX4nRPz1qrff; Tue, 18 Aug 2020 16:51:58 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4BWDQQ06Pkz1qw74; Tue, 18 Aug 2020 16:51:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id LWUO4G1BT4fj; Tue, 18 Aug 2020 16:51:56 +0200 (CEST) X-Auth-Info: DCEnwxByMyNTdxZ9MycUEdurVz87EDooFxhcWPD98Flztj4THCgDTBIV33A3KT1v Received: from igel.home (ppp-46-244-180-122.dynamic.mnet-online.de [46.244.180.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 18 Aug 2020 16:51:56 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 532362C28F0; Tue, 18 Aug 2020 16:51:56 +0200 (CEST) From: Andreas Schwab To: YueHaibing Cc: , , , , , , , , , , Subject: Re: [PATCH] net: stmmac: Fix signedness bug in stmmac_probe_config_dt() References: <20200818143952.50752-1-yuehaibing@huawei.com> X-Yow: I'm also against BODY-SURFING!! Date: Tue, 18 Aug 2020 16:51:56 +0200 In-Reply-To: <20200818143952.50752-1-yuehaibing@huawei.com> (yuehaibing@huawei.com's message of "Tue, 18 Aug 2020 22:39:52 +0800") Message-ID: <87ft8katwz.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Aug 18 2020, YueHaibing wrote: > The "plat->phy_interface" variable is an enum and in this context GCC > will treat it as an unsigned int so the error handling is never > triggered. > > Fixes: b9f0b2f634c0 ("net: stmmac: platform: fix probe for ACPI devices") > Signed-off-by: YueHaibing > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index f32317fa75c8..b5b558b02e7d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -413,7 +413,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > } > > plat->phy_interface = device_get_phy_mode(&pdev->dev); > - if (plat->phy_interface < 0) > + if ((int)plat->phy_interface < 0) > return ERR_PTR(plat->phy_interface); I don't think the conversion to long when passed to ERR_PTR will produce a negative value either (if long is wider than unsigned int). Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."