Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1552461

RE: [PATCH] net: stmmac: fix maxmtu assignment to be within valid range

From "Kweh, Hock Leong" <hock.leong.kweh@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] net: stmmac: fix maxmtu assignment to be within valid range
Date 2017-01-06 03:00 +0100
Message-ID <sWrYZ-2TE-7@gated-at.bofh.it> (permalink)
References <sW6hQ-4Xa-7@gated-at.bofh.it> <sWnsm-8rY-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> -----Original Message-----
> From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com]
> Sent: Friday, January 06, 2017 5:07 AM
> To: Kweh, Hock Leong <hock.leong.kweh@intel.com>
> Cc: David S. Miller <davem@davemloft.net>; Joao Pinto
> <Joao.Pinto@synopsys.com>; Giuseppe CAVALLARO <peppe.cavallaro@st.com>;
> seraphin.bonnaffe@st.com; Jarod Wilson <jarod@redhat.com>; Alexandre
> TORGUE <alexandre.torgue@gmail.com>; Joachim Eastwood
> <manabian@gmail.com>; Niklas Cassel <niklas.cassel@axis.com>; Johan Hovold
> <johan@kernel.org>; Pavel Machek <pavel@ucw.cz>; lars.persson@axis.com;
> netdev <netdev@vger.kernel.org>; LKML <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH] net: stmmac: fix maxmtu assignment to be within valid
> range
> 
> On Thu, Jan 5, 2017 at 12:47 PM, Kweh, Hock Leong
> <hock.leong.kweh@intel.com> wrote:
> > From: "Kweh, Hock Leong" <hock.leong.kweh@intel.com>
> >
> > There is no checking valid value of maxmtu when getting it from devicetree.
> 
> 'Device Tree' or 'device tree' ?

Noted & Thanks. Submitting V2.

> 
> > This resolution added the checking condition to ensure the assignment
> > is made within a valid range.
> 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 39eb7a6..683d59f 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -3319,7 +3319,8 @@ int stmmac_dvr_probe(struct device *device,
> >                 ndev->max_mtu = JUMBO_LEN;
> >         else
> >                 ndev->max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
> > -       if (priv->plat->maxmtu < ndev->max_mtu)
> > +       if ((priv->plat->maxmtu < ndev->max_mtu) &&
> > +           (priv->plat->maxmtu >= ndev->min_mtu))
> >                 ndev->max_mtu = priv->plat->maxmtu;
> 
> Perhaps add a warning message on else branch?

Noted & Thanks. Submitting V2.

> 
> --
> With Best Regards,
> Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] net: stmmac: fix maxmtu assignment to be within valid range "Kweh, Hock Leong" <hock.leong.kweh@intel.com> - 2017-01-05 03:50 +0100
  Re: [PATCH] net: stmmac: fix maxmtu assignment to be within valid range Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-05 22:10 +0100
    RE: [PATCH] net: stmmac: fix maxmtu assignment to be within valid  range "Kweh, Hock Leong" <hock.leong.kweh@intel.com> - 2017-01-06 03:00 +0100

csiph-web