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]
Message-ID: <ZHW9J/MkJs2svYsG@shell.armlinux.org.uk>
Date:   Tue, 30 May 2023 10:08:55 +0100
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Lu Hongfei <luhongfei@...o.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        "open list:ETHERNET PHY LIBRARY" <netdev@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        opensource.kernel@...o.com
Subject: Re: [PATCH] net: Replace the ternary conditional operator with min()

On Tue, May 30, 2023 at 04:45:30PM +0800, Lu Hongfei wrote:
> It would be better to replace the traditional ternary conditional
> operator with min()

I don't think this is any "better". It's not really a "let's return the
minimum of two values" even though that is what it ends up functionally
being.

Semantically, it's "Is there an error? Yes, then return the error.
Otherwise return success" where an error in the kernel is defined as a
negative integer and success as generally zero, or sometimes a small
positive integer.

Replacing these with "min()" makes the code _less_ readable.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ