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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Oct 2021 18:53:54 +0200
From:   Antoine Tenart <atenart@...nel.org>
To:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Sean Anderson <sean.anderson@...o.com>, netdev@...r.kernel.org
Cc:     Russell King <linux@...linux.org.uk>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>
Subject: Re: [PATCH v2 1/2] net: macb: Clean up macb_validate

Quoting Sean Anderson (2021-10-12 18:34:50)
> On 10/12/21 4:33 AM, Antoine Tenart wrote:
> > Quoting Sean Anderson (2021-10-11 18:55:16)
> >> As the number of interfaces grows, the number of if statements grows
> >> ever more unweildy. Clean everything up a bit by using a switch
> >> statement. No functional change intended.
> 
> > Maybe you could try a mixed approach; keeping the invalid modes checks
> > (bitmap_zero) at the beginning and once we know the mode is valid using
> > a switch statement. That might make it easier to read as this should
> > remove lots of conditionals. (We'll still have the one/_NA checks
> > though).
> 
> This is actually the issue I wanted to address. The interface checks are
> effectively performed twice or sometimes three times. There are also
> gotos in the original design to deal with e.g. 10GBASE not having
> 10/100/1000 modes. This makes it easy to introduce bugs when adding new
> modes, such as what happened with SGMII.

I don't think having 1) validity checks 2) availability checks is an
issue. It's a choice between having possible bugs because the two steps
aren't synced vs possible bugs because one of the multiple paths in the
switch gets slightly broken by a patch. IMHO the one easier to read and
follow should win here.

Antoine

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ