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-2-alx.manpages@gmail.com>
Date:   Sat, 20 Nov 2021 14:00:44 +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 01/20] linux/stddef.h, linux/offsetof.h: Split offsetof() into a separate header

Include <linux/offsetof.h> from <linux/stddef.h> for compatibility.

>From <linux/offsetof.h>:
	Include the same exact deps that <linux/stddef.h> had.
	Changing that in any way broke my compilation.

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>

f
---
 include/linux/offsetof.h | 17 +++++++++++++++++
 include/linux/stddef.h   | 11 ++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)
 create mode 100644 include/linux/offsetof.h

diff --git a/include/linux/offsetof.h b/include/linux/offsetof.h
new file mode 100644
index 000000000000..3db431197687
--- /dev/null
+++ b/include/linux/offsetof.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_OFFSETOF_H
+#define _LINUX_OFFSETOF_H
+
+
+#include <uapi/linux/stddef.h>
+
+
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(T, m)	__compiler_offsetof(T, m)
+#else
+#define offsetof(T, m)	((size_t)&((T *)0)->m)
+#endif
+
+
+#endif  /* _LINUX_OFFSETOF_H */
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index ca507bd5f808..41217710788e 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -2,8 +2,12 @@
 #ifndef _LINUX_STDDEF_H
 #define _LINUX_STDDEF_H
 
+
 #include <uapi/linux/stddef.h>
 
+#include <linux/offsetof.h>
+
+
 #undef NULL
 #define NULL ((void *)0)
 
@@ -12,13 +16,6 @@ enum {
 	true	= 1
 };
 
-#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE, MEMBER)	__compiler_offsetof(TYPE, MEMBER)
-#else
-#define offsetof(TYPE, MEMBER)	((size_t)&((TYPE *)0)->MEMBER)
-#endif
-
 /**
  * sizeof_field() - Report the size of a struct field in bytes
  *
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ