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-8-alx.manpages@gmail.com>
Date:   Sat, 20 Nov 2021 14:00:50 +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 07/20] linux/memberof.h: Add memberof(T, m) macro

(((T *)0)->m) if a typical construct used by some wrappers,
and also directly in many places.
Write a macro to encapsulate that construct,
and avoid repetition (and possible mistakes).

It also helps readability by reducing the complexity
of mentally parsing so many symbols together,
with a readable name.

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

diff --git a/include/linux/memberof.h b/include/linux/memberof.h
new file mode 100644
index 000000000000..6d8cb3dabbf9
--- /dev/null
+++ b/include/linux/memberof.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MEMBEROF_H
+#define _LINUX_MEMBEROF_H
+
+
+#include <linux/NULL.h>
+
+
+#define memberof(T, m)  (((T *)NULL)->m)
+
+
+#endif  /* _LINUX_MEMBEROF_H */
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ