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


Groups > linux.kernel > #1553513

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

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4] net: stmmac: fix maxmtu assignment to be within valid range
Date 2017-01-07 01:20 +0100
Message-ID <sWMTM-19v-9@gated-at.bofh.it> (permalink)
References <sWMK5-14E-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Jan 7, 2017 at 10:10 AM, 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 device tree.
> This resolution added the checking condition to ensure the assignment is
> made within a valid range.

> changelog v4:
> * add print warning message when maxmtu > max_mtu as well

Yep.

> * add maxmtu = JUMBO_LEN into each *_default_data() at stmmac_pci.c

Yep.

But see comment below.

P.S. And perhaps next time send into our internal mailing list first for review.

> @@ -3345,8 +3345,14 @@ 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;

> +       else if ((priv->plat->maxmtu < ndev->min_mtu) ||
> +                (priv->plat->maxmtu > ndev->max_mtu))
> +               netdev_warn(priv->dev,

What is the difference to just 'else'? (Returning back to my initial
proposal, I don't remember telling anything about 'else if' concept)

> +                           "%s: warning: maxmtu having invalid value (%d)\n",
> +                           __func__, priv->plat->maxmtu);

-- 
With Best Regards,
Andy Shevchenko

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


Thread

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

csiph-web