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:   Sat, 20 Nov 2021 14:00:49 +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 06/20] linux/kernel.h, linux/array_size.h: Split ARRAY_SIZE() into a separate header

Include <linux/array_size.h> from <linux/kernel.h> for compatibility.

Include <linux/compiler.h> for __must_be_array().

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 include/linux/array_size.h | 15 +++++++++++++++
 include/linux/kernel.h     |  9 +++------
 2 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 include/linux/array_size.h

diff --git a/include/linux/array_size.h b/include/linux/array_size.h
new file mode 100644
index 000000000000..cba90f2248ef
--- /dev/null
+++ b/include/linux/array_size.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_ARRAY_SIZE_H
+#define _LINUX_ARRAY_SIZE_H
+
+#include <linux/compiler.h>
+
+
+/**
+ * ARRAY_SIZE - get the number of elements in array @a
+ * @a: array to be sized
+ */
+#define ARRAY_SIZE(a)  (sizeof((a)) / sizeof((a)[0]) + __must_be_array(a))
+
+
+#endif  /* _LINUX_ARRAY_SIZE_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 77755ac3e189..db6021ce3e0e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -2,6 +2,8 @@
 #ifndef _LINUX_KERNEL_H
 #define _LINUX_KERNEL_H
 
+
+#include <linux/array_size.h>
 #include <linux/stdarg.h>
 #include <linux/align.h>
 #include <linux/limits.h>
@@ -25,6 +27,7 @@
 
 #include <uapi/linux/kernel.h>
 
+
 #define STACK_MAGIC	0xdeadbeef
 
 /**
@@ -39,12 +42,6 @@
 #define READ			0
 #define WRITE			1
 
-/**
- * ARRAY_SIZE - get the number of elements in array @arr
- * @arr: array to be sized
- */
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
-
 #define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
 
 #define u64_to_user_ptr(x) (		\
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ