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:   Fri, 19 Nov 2021 12:36:43 +0100
From:   Alejandro Colomar <alx.manpages@...il.com>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Alejandro Colomar <alx.manpages@...il.com>
Subject: [PATCH 15/17] linux/offsetofend.h: Move offsetofend(T, m) to a separate header

Touching files so used for the kernel,
forces 'make' to recompile most of the kernel.

Having those definitions in more granular files
helps avoid recompiling so much of the kernel.

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 include/linux/filter.h      |  1 +
 include/linux/offsetofend.h | 19 +++++++++++++++++++
 include/linux/skmsg.h       |  1 +
 include/linux/stddef.h      | 10 +---------
 include/linux/string.h      |  1 +
 5 files changed, 23 insertions(+), 9 deletions(-)
 create mode 100644 include/linux/offsetofend.h

diff --git a/include/linux/filter.h b/include/linux/filter.h
index ebb0ae480533..5593d0365694 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -18,6 +18,7 @@
 #include <linux/kallsyms.h>
 #include <linux/if_vlan.h>
 #include <linux/offsetof.h>
+#include <linux/offsetofend.h>
 #include <linux/sizeof_field.h>
 #include <linux/vmalloc.h>
 #include <linux/sockptr.h>
diff --git a/include/linux/offsetofend.h b/include/linux/offsetofend.h
new file mode 100644
index 000000000000..4f4d0e1b667a
--- /dev/null
+++ b/include/linux/offsetofend.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_OFFSETOFEND_H
+#define _LINUX_OFFSETOFEND_H
+
+#include <linux/offsetof.h>
+#include <linux/sizeof_field.h>
+
+
+/**
+ * offsetofend() - Report the offset of a struct field within the struct
+ *
+ * @TYPE: The type of the structure
+ * @MEMBER: The member within the structure to get the end offset of
+ */
+#define offsetofend(TYPE, MEMBER) \
+	(offsetof(TYPE, MEMBER)	+ sizeof_field(TYPE, MEMBER))
+
+
+#endif  /* _LINUX_OFFSETOFEND_H */
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index 584d94be9c8b..46e76f4ff0de 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -6,6 +6,7 @@
 
 #include <linux/bpf.h>
 #include <linux/filter.h>
+#include <linux/offsetofend.h>
 #include <linux/scatterlist.h>
 #include <linux/skbuff.h>
 
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 5c9aedb5e6ad..da50edf4b28d 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -5,6 +5,7 @@
 #include <uapi/linux/stddef.h>
 #include <linux/NULL.h>
 #include <linux/offsetof.h>
+#include <linux/offsetofend.h>
 #include <linux/sizeof_field.h>
 
 
@@ -13,15 +14,6 @@ enum {
 	true	= 1
 };
 
-/**
- * offsetofend() - Report the offset of a struct field within the struct
- *
- * @TYPE: The type of the structure
- * @MEMBER: The member within the structure to get the end offset of
- */
-#define offsetofend(TYPE, MEMBER) \
-	(offsetof(TYPE, MEMBER)	+ sizeof_field(TYPE, MEMBER))
-
 /**
  * struct_group() - Wrap a set of declarations in a mirrored struct
  *
diff --git a/include/linux/string.h b/include/linux/string.h
index 5a22a93c53f5..555b6f00c73d 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -7,6 +7,7 @@
 #include <linux/types.h>	/* for size_t */
 #include <linux/errno.h>	/* for E2BIG */
 #include <linux/offsetof.h>
+#include <linux/offsetofend.h>
 #include <linux/stdarg.h>
 #include <uapi/linux/string.h>
 
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ