hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/kernel/ucount.c
....@@ -1,9 +1,4 @@
1
-/*
2
- * This program is free software; you can redistribute it and/or
3
- * modify it under the terms of the GNU General Public License as
4
- * published by the Free Software Foundation, version 2 of the
5
- * License.
6
- */
1
+// SPDX-License-Identifier: GPL-2.0-only
72
83 #include <linux/stat.h>
94 #include <linux/sysctl.h>
....@@ -57,16 +52,14 @@
5752 .permissions = set_permissions,
5853 };
5954
60
-static int zero = 0;
61
-static int int_max = INT_MAX;
6255 #define UCOUNT_ENTRY(name) \
6356 { \
6457 .procname = name, \
6558 .maxlen = sizeof(int), \
6659 .mode = 0644, \
6760 .proc_handler = proc_dointvec_minmax, \
68
- .extra1 = &zero, \
69
- .extra2 = &int_max, \
61
+ .extra1 = SYSCTL_ZERO, \
62
+ .extra2 = SYSCTL_INT_MAX, \
7063 }
7164 static struct ctl_table user_table[] = {
7265 UCOUNT_ENTRY("max_user_namespaces"),
....@@ -76,6 +69,7 @@
7669 UCOUNT_ENTRY("max_net_namespaces"),
7770 UCOUNT_ENTRY("max_mnt_namespaces"),
7871 UCOUNT_ENTRY("max_cgroup_namespaces"),
72
+ UCOUNT_ENTRY("max_time_namespaces"),
7973 #ifdef CONFIG_INOTIFY_USER
8074 UCOUNT_ENTRY("max_inotify_instances"),
8175 UCOUNT_ENTRY("max_inotify_watches"),
....@@ -88,6 +82,8 @@
8882 {
8983 #ifdef CONFIG_SYSCTL
9084 struct ctl_table *tbl;
85
+
86
+ BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
9187 setup_sysctl_set(&ns->set, &set_root, set_is_seen);
9288 tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
9389 if (tbl) {