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>] [day] [month] [year] [list]
Message-ID: <87bmsluf49.wl-satoru.takeuchi@gmail.com>
Date:   Wed, 29 Mar 2017 08:59:50 +0900
From:   Satoru Takeuchi <satoru.takeuchi@...il.com>
To:     linux-kernel@...r.kernel.org
Subject: [PATCH] cgroup: change the limit of CGROUP_SUBSYS_COUNT depending on the size of the corresponding bitmasks

The limit of CGROUP_SUBSYS_COUNT is hardcoded to 16. This value comes from
the size of the corresponding bitmasks, u16. It's better to change this limit
depending on the size of the corresponding bitmasks because of the following
reasons.

- to avoid setting the wrong limit when the size of the corresponding bitmasks
  are changed
- to make the meaning of this limit clear

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@...il.com>
---
 kernel/cgroup/cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 4885132..576b184 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4490,7 +4490,8 @@ int __init cgroup_init(void)
 	struct cgroup_subsys *ss;
 	int ssid;
 
-	BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 16);
+	BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > (sizeof(cgroup_disable_mask) * __CHAR_BIT__));
+
 	BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
 	BUG_ON(cgroup_init_cftypes(NULL, cgroup_base_files));
 	BUG_ON(cgroup_init_cftypes(NULL, cgroup1_base_files));
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ