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: Fri, 25 Aug 2023 09:32:02 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Mahmoud Maatuq' <mahmoudmatook.mm@...il.com>, "keescook@...omium.org"
	<keescook@...omium.org>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"willemdebruijn.kernel@...il.com" <willemdebruijn.kernel@...il.com>,
	"wad@...omium.org" <wad@...omium.org>, "luto@...capital.net"
	<luto@...capital.net>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"kuba@...nel.org" <kuba@...nel.org>, "shuah@...nel.org" <shuah@...nel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>, "linux-kselftest@...r.kernel.org"
	<linux-kselftest@...r.kernel.org>, "davem@...emloft.net"
	<davem@...emloft.net>
CC: "linux-kernel-mentees@...ts.linuxfoundation.org"
	<linux-kernel-mentees@...ts.linuxfoundation.org>
Subject: RE: [PATCH v2 2/2] selftests/net: replace ternary operator with
 min()/max()

From: Mahmoud Maatuq
> Sent: 24 August 2023 21:24
....
>  		tdeliver = glob_tstart + ts->delay_us * 1000;
> -		tdeliver_max = tdeliver_max > tdeliver ?
> -			       tdeliver_max : tdeliver;
> +		tdeliver_max = max(tdeliver_max, tdeliver);

That was spectacularly horrid...
What is wrong with using:
	if (tdeliver > tdeliver_max)
		tdeliver_max = tdeliver;
That is pretty obviously calculating the upper bound.
Even the version with max() needs extra parsing by the human reader.

(The only issue is whether it reads better with the if condition
reversed.)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ