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: Mon, 26 Feb 2024 10:07:03 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jani Nikula' <jani.nikula@...ux.intel.com>,
	"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>, "'Linus
 Torvalds'" <torvalds@...ux-foundation.org>, 'Netdev'
	<netdev@...r.kernel.org>, "'dri-devel@...ts.freedesktop.org'"
	<dri-devel@...ts.freedesktop.org>
CC: 'Jens Axboe' <axboe@...nel.dk>, "'Matthew Wilcox (Oracle)'"
	<willy@...radead.org>, 'Christoph Hellwig' <hch@...radead.org>,
	"'linux-btrfs@...r.kernel.org'" <linux-btrfs@...r.kernel.org>, "'Andrew
 Morton'" <akpm@...ux-foundation.org>, 'Andy Shevchenko'
	<andriy.shevchenko@...ux.intel.com>, "'David S . Miller'"
	<davem@...emloft.net>, 'Dan Carpenter' <dan.carpenter@...aro.org>, "Rasmus
 Villemoes" <linux@...musvillemoes.dk>
Subject: RE: [PATCH next v2 02/11] minmax: Use _Static_assert() instead of
 static_assert()

From: Jani Nikula
> Sent: 26 February 2024 09:28
> 
> On Sun, 25 Feb 2024, David Laight <David.Laight@...LAB.COM> wrote:
> > The wrapper just adds two more lines of error output when the test fails.
> 
> There are only a handful of places in kernel code that use
> _Static_assert() directly. Nearly 900 instances of static_assert().

How many of those supply an error message?

> Are we now saying it's fine to use _Static_assert() directly all over
> the place? People will copy-paste and cargo cult.

Is that actually a problem?
The wrapper allows the error message to be omitted and substitutes
the text of the conditional.
But it isn't 'free'.
As well as slightly slowing down the compilation, the error messages
from the compiler get more difficult to interpret.

Most of the static_assert() will probably never generate an error.
But the ones in min()/max() will so it is best to make them as
readable as possible.
(Don't even look as the mess clang makes....)

	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