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: <20211120130104.185699-13-alx.manpages@gmail.com>
Date:   Sat, 20 Nov 2021 14:00:55 +0100
From:   Alejandro Colomar <alx.manpages@...il.com>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Alejandro Colomar <alx.manpages@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Kees Cook <keescook@...omium.org>,
        Joe Perches <joe@...ches.com>
Subject: [PATCH v2 12/20] linux/must_be.h: Add must_be() to improve readability of BUILD_BUG_ON_ZERO()

Historically, BUILD_BUG_ON_ZERO() has been hard to read.
__must_be_array() is based on BUILD_BUG_ON_ZERO(),
and unlike BUILD_BUG_ON_*(),
it has a pretty readable name.

Let's generalize it with this kind of usage:

	#define __must_be_array(a)  must_be(__is_array(a))

So next step is to create macros of the kind:
__is_array(a)

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 include/linux/must_be.h | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 include/linux/must_be.h

diff --git a/include/linux/must_be.h b/include/linux/must_be.h
new file mode 100644
index 000000000000..a2e0b0c890a6
--- /dev/null
+++ b/include/linux/must_be.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MUST_BE_H
+#define _LINUX_MUST_BE_H
+
+
+#define __must_be(e)  BUILD_BUG_ON_ZERO(!(e))
+
+
+#endif	/* _LINUX_MUST_BE_H */
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ