[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60DB97285@dggemm513-mbs.china.huawei.com>
Date: Sat, 26 Dec 2020 07:54:04 +0000
From: wangyunjian <wangyunjian@...wei.com>
To: liuyonglong <liuyonglong@...wei.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "Zhuangyuzeng (Yisen)" <yisen.zhuang@...wei.com>,
Salil Mehta <salil.mehta@...wei.com>,
"Lilijun (Jerry)" <jerry.lilijun@...wei.com>,
xudingke <xudingke@...wei.com>
Subject: RE: [PATCH net] net: hns: fix return value check in
__lb_other_process()
> -----Original Message-----
> From: liuyonglong
> Sent: Saturday, December 26, 2020 2:39 PM
> To: wangyunjian <wangyunjian@...wei.com>; netdev@...r.kernel.org
> Cc: Zhuangyuzeng (Yisen) <yisen.zhuang@...wei.com>; Salil Mehta
> <salil.mehta@...wei.com>; Lilijun (Jerry) <jerry.lilijun@...wei.com>;
> xudingke <xudingke@...wei.com>
> Subject: Re: [PATCH net] net: hns: fix return value check in
> __lb_other_process()
>
>
> On 2020/12/25 18:35, wangyunjian wrote:
> > From: Yunjian Wang <wangyunjian@...wei.com>
> >
> > The function skb_copy() could return NULL, the return value need to be
> > checked.
> >
> > Fixes: b5996f11ea54 ("net: add Hisilicon Network Subsystem basic
> > ethernet support")
> > Signed-off-by: Yunjian Wang <wangyunjian@...wei.com>
> > ---
> > drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> > b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> > index 7165da0ee9aa..ad18f0e20a23 100644
> > --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> > +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> > @@ -415,6 +415,10 @@ static void __lb_other_process(struct
> hns_nic_ring_data *ring_data,
> > /* for mutl buffer*/
> > new_skb = skb_copy(skb, GFP_ATOMIC);
> > dev_kfree_skb_any(skb);
> > + if (!new_skb) {
>
> > + ndev->stats.rx_dropped++;
> You can add a new drop type to ring->states, and then add it to
> ndev->stats.rx_dropped,
>
> then you can know that the rx_dropped is from skb_copy() failed.
>
> This process is from self-test, maybe you can just add a error message rather
> than increase
Thanks for your suggestion, I will update it in next version.
>
> the ndev->stats.rx_dropped.
>
>
> > + return;
> > + }
> > skb = new_skb;
> >
> > check_ok = 0;
Powered by blists - more mailing lists