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-21-alx.manpages@gmail.com>
Date:   Sat, 20 Nov 2021 14:01:03 +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 19/20] linux/build_bug.h, linux/power_of_2.h: Move [__]BUILD_BUG_ON_NOT_POWER_OF_2() to <linux/power_of_2.h>

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 include/linux/build_bug.h  | 7 +------
 include/linux/power_of_2.h | 9 +++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index 539e3d5df027..65f64cd399be 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -5,14 +5,9 @@
 
 #include <linux/compiler.h>
 #include <linux/must_be.h>
+#include <linux/power_of_2.h>
 
 
-/* Force a compilation error if a constant expression is not a power of 2 */
-#define __BUILD_BUG_ON_NOT_POWER_OF_2(n)	\
-	BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
-#define BUILD_BUG_ON_NOT_POWER_OF_2(n)			\
-	BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
-
 /*
  * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
  * expression but avoids the generation of any code, even if that expression
diff --git a/include/linux/power_of_2.h b/include/linux/power_of_2.h
index 812fe86eefcd..132592f0b718 100644
--- a/include/linux/power_of_2.h
+++ b/include/linux/power_of_2.h
@@ -3,8 +3,17 @@
 #define _LINUX_POWER_OF_2_H
 
 
+#include <linux/build_bug.h>
+
+
 #define __IS_POWER_OF_2_OR_0(n)  (((n) & ((n) - 1)) == 0)
 #define __IS_POWER_OF_2(n)       (__IS_POWER_OF_2_OR_0(n) && ((n) != 0))
 
+/* Force a compilation error if a constant expression is not a power of 2 */
+#define __BUILD_BUG_ON_NOT_POWER_OF_2(n)	\
+	BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n)			\
+	BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
+
 
 #endif	/* _LINUX_POWER_OF_2_H */
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ