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: <bcdd94d75fec4f3994f0123197d71bbd@AcuMS.aculab.com>
Date: Sun, 28 Jul 2024 14:22:19 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
CC: 'Linus Torvalds' <torvalds@...uxfoundation.org>, 'Jens Axboe'
	<axboe@...nel.dk>, "'Matthew Wilcox (Oracle)'" <willy@...radead.org>,
	'Christoph Hellwig' <hch@...radead.org>, 'Andrew Morton'
	<akpm@...ux-foundation.org>, 'Andy Shevchenko'
	<andriy.shevchenko@...ux.intel.com>, 'Dan Carpenter'
	<dan.carpenter@...aro.org>, 'Arnd Bergmann' <arnd@...nel.org>,
	"'Jason@...c4.com'" <Jason@...c4.com>, "'pedro.falcato@...il.com'"
	<pedro.falcato@...il.com>, 'Mateusz Guzik' <mjguzik@...il.com>,
	"'linux-mm@...ck.org'" <linux-mm@...ck.org>, 'Lorenzo Stoakes'
	<lorenzo.stoakes@...cle.com>
Subject: [PATCH v2 6/8] minmax: Optimise _Static_assert() check in clamp()

Use __if_constexpr() instead of __builtin_choose_expr(__is_constexpr()).

Signed-off-by: David Laight <david.laight@...lab.com>
---
v2 - no change

The misaligned \ is fixed in a later path.

 include/linux/minmax.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index a0c948ad576d..ad57c8eddc8a 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -142,8 +142,7 @@
 	typeof(val) unique_val = (val);						\
 	typeof(lo) unique_lo = (lo);						\
 	typeof(hi) unique_hi = (hi);						\
-	_Static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)),	\
-			(lo) <= (hi), true),					\
+	_Static_assert(__if_constexpr((lo) <= (hi), (lo) <= (hi), true),		\
 		"clamp() low limit " #lo " greater than high limit " #hi);	\
 	_Static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error");	\
 	_Static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error");	\
-- 
2.17.1

-
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