lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKgT0UfjtKL0_OxKpEt4CzA4MztXckkVxMZkQ85B11bYomfOOw@mail.gmail.com>
Date:   Thu, 5 Jan 2023 08:13:40 -0800
From:   Alexander Duyck <alexander.duyck@...il.com>
To:     Lukasz Majewski <lukma@...x.de>
Cc:     Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] dsa: marvell: Provide per device information about
 max frame size

On Thu, Jan 5, 2023 at 2:37 AM Lukasz Majewski <lukma@...x.de> wrote:
>
> Hi Andrew, Alexander,
>
> > Hi Andrew,
> >
> > > > @@ -3548,7 +3548,9 @@ static int mv88e6xxx_get_max_mtu(struct
> > > > dsa_switch *ds, int port) if
> > > > (chip->info->ops->port_set_jumbo_size) return 10240 -
> > > > VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; else if
> > > > (chip->info->ops->set_max_frame_size)
> > > > -         return 1632 - VLAN_ETH_HLEN - EDSA_HLEN -
> > > > ETH_FCS_LEN;
> > > > +         return (max_t(int, chip->info->max_frame_size,
> > > > 1632)
> > > > +                 - VLAN_ETH_HLEN - EDSA_HLEN -
> > > > ETH_FCS_LEN); +
> > > >   return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
> > > >
> > >
> > > I would also prefer if all this if/else logic is removed, and the
> > > code simply returned chip->info->max_frame_size - VLAN_ETH_HLEN -
> > > EDSA_HLEN - ETH_FCS_LEN;
> > >
> >
> > So then the mv88e6xxx_get_max_mtu shall look like:
> >
> > WARN_ON_ONCE(!chip->info->max_frame_size)
> >
> > if (chip->info->ops->port_set_jumbo_size)
> > ...
> > else
> >     return chip->info->max_frame_size - VLAN_ETH_HLEN -
> >       EDSA_HLEN - ETH_FCS_LEN;
> >
> >
> > Or shall I put WARN_ON_ONCE to the mv88e6xxx_probe() function?
> >
> >
> > The above approach is contrary to one proposed by Alexander, who
> > wanted to improve the defensive approach in this driver (to avoid
> > situation where the max_frame_size callback is not defined and
> > max_frame_size member of *_info struct is not added by developer).
> >
> > Which approach is the recommended one for this driver?
>
> Is there any decision regarding the preferred approach to rewrite this
> code?

I would defer to what Andrew proposed since he has more experience
with the DSA code than I do.

Thanks,

- Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ