Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4984512rwb; Wed, 21 Sep 2022 01:12:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KTqupxgtZMb3DIJRXgqTy8G/USKNiAuRWav+ZTgpiYrvxgiMdgjU53TbVy48dCj5Gq1b0 X-Received: by 2002:a05:6a00:bea:b0:53e:d0c0:faed with SMTP id x42-20020a056a000bea00b0053ed0c0faedmr27441117pfu.30.1663747967285; Wed, 21 Sep 2022 01:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663747967; cv=none; d=google.com; s=arc-20160816; b=FhXcIP9PNT5KiQj0SStz/lM7PjMzAKAmhXZZca/pXAzHoeg1MmBzlxnfvQTx0BpT4T zWjOnoEygTEezfjxHzfzmwsqg98TSvJFOluEhEVwlwGQX0f4veHGxcPgSAnY6IFJwEhF LoSnhwpxn3GQazzHWNcdwDt4UVCD/YPxfSdSxR27NmeLYgGBlG1JXGVJUWeEzNWExnLW nuVPzturydkr9UwqLDU7NnURHpt7dlJWmffMW3eC9eC0zjPDvS2GCB3sJOBS5EfYibca ie3KulRX6OXRZuOu/UZBCOhWsrRyL6JauKmx2BNLxmkPqrze72n4WjbE+jjylmcjtKo8 gVSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JKZp3P4UuD5mypRSKKOSy/3xQ5yoXn4dkrsnvftRZIg=; b=lRdoBnin+LqWmHBxZNkSp46EgnMw8LVa7sQ9hd0TQkj6WepZtGWf+oUqId/Rv9IKEn 3LEvr8PYBNutmai+6a+LUtxYL6lYkveC4LWsHEJRAJpqf6+fSTbd+MW8Q9hWV4Www88e LhglE9Nv8vR6Lun19Fst7/yo0Vsy0kv/CFuAecArZBi3ffQ8/1/dCfuJqEIbkN8NebK5 EWfNJnPKIBi5qkn5JcBWFDXuGRGQ9YqbW6nB3FAhXjSkz5YHSGex3RV2bP7s3oTpbyCc v1jC71xgl7CnPbiGKSlkonxvMhBiEesfZju3KXuZm4/WcKtgb7/2CBKrevbxjIgUEfn5 LksA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a170902e54d00b00172f12565c1si2312565plf.231.2022.09.21.01.12.35; Wed, 21 Sep 2022 01:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbiIUHos (ORCPT + 99 others); Wed, 21 Sep 2022 03:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiIUHoq (ORCPT ); Wed, 21 Sep 2022 03:44:46 -0400 Received: from a.mx.secunet.com (a.mx.secunet.com [62.96.220.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF56A65B6; Wed, 21 Sep 2022 00:44:43 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 77A2B201E2; Wed, 21 Sep 2022 09:44:41 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EY6uRd3Yvca6; Wed, 21 Sep 2022 09:44:40 +0200 (CEST) Received: from mailout1.secunet.com (mailout1.secunet.com [62.96.220.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id EFA0020189; Wed, 21 Sep 2022 09:44:40 +0200 (CEST) Received: from cas-essen-01.secunet.de (unknown [10.53.40.201]) by mailout1.secunet.com (Postfix) with ESMTP id DFCFC80004A; Wed, 21 Sep 2022 09:44:40 +0200 (CEST) Received: from mbx-essen-01.secunet.de (10.53.40.197) by cas-essen-01.secunet.de (10.53.40.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 09:44:40 +0200 Received: from gauss2.secunet.de (10.182.7.193) by mbx-essen-01.secunet.de (10.53.40.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 09:44:40 +0200 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 16C8C31829EC; Wed, 21 Sep 2022 09:44:40 +0200 (CEST) Date: Wed, 21 Sep 2022 09:44:40 +0200 From: Steffen Klassert To: Li Zhong CC: , , , , , , , Subject: Re: [PATCH v1] drivers/net/ethernet/3com: check the return value of vortex_up() Message-ID: <20220921074440.GA2950045@gauss3.secunet.de> References: <20220919073631.1574577-1-floridsleeves@gmail.com> <20220920100157.GV2950045@gauss3.secunet.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: cas-essen-02.secunet.de (10.53.40.202) To mbx-essen-01.secunet.de (10.53.40.197) X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 20, 2022 at 09:15:35AM -0700, Li Zhong wrote: > On Tue, Sep 20, 2022 at 3:02 AM Steffen Klassert > wrote: > > > > On Mon, Sep 19, 2022 at 12:36:31AM -0700, Li Zhong wrote: > > > Check the return value of vortex_up(), which could be error code when > > > the rx ring is not full. > > > > > > Signed-off-by: Li Zhong > > > --- > > > drivers/net/ethernet/3com/3c59x.c | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c > > > index ccf07667aa5e..7806c5f60ac8 100644 > > > --- a/drivers/net/ethernet/3com/3c59x.c > > > +++ b/drivers/net/ethernet/3com/3c59x.c > > > @@ -1942,6 +1942,7 @@ vortex_error(struct net_device *dev, int status) > > > void __iomem *ioaddr = vp->ioaddr; > > > int do_tx_reset = 0, reset_mask = 0; > > > unsigned char tx_status = 0; > > > + int err; > > > > > > if (vortex_debug > 2) { > > > pr_err("%s: vortex_error(), status=0x%x\n", dev->name, status); > > > @@ -2016,7 +2017,9 @@ vortex_error(struct net_device *dev, int status) > > > /* Must not enter D3 or we can't legally issue the reset! */ > > > vortex_down(dev, 0); > > > issue_and_wait(dev, TotalReset | 0xff); > > > - vortex_up(dev); /* AKPM: bug. vortex_up() assumes that the rx ring is full. It may not be. */ > > > + err = vortex_up(dev); > > > + if (err) > > > + return; > > > > Why does that fix the bug mentioned in the above comment? > > > > Since the bug is an unchecked error No, it is not. It is completely pointless to check the error value here. > we detect it with static analysis and > validate it's a bug by the comment we see above the code. This code is from the nineties, so it is unfixed for more then 20 years. Do you really think Andrew Morton would have added this comment if the fix is that easy?