]> git.baikalelectronics.ru Git - kernel.git/commitdiff
sysctl: move maxolduid as a sysctl specific const
authorLuis Chamberlain <mcgrof@kernel.org>
Sat, 22 Jan 2022 06:13:03 +0000 (22:13 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Jan 2022 06:33:36 +0000 (08:33 +0200)
The maxolduid value is only shared for sysctl purposes for use on a max
range.  Just stuff this into our shared const array.

[akpm@linux-foundation.org: fix sysctl_vals[], per Mickaël]

Link: https://lkml.kernel.org/r/20211129205548.605569-5-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Lukas Middendorf <kernel@tuxforce.de>
Cc: Stephen Kitt <steve@sk2.org>
Cc: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/proc_sysctl.c
include/linux/sysctl.h
kernel/sysctl.c

index 2eb5987091eacad73b6f9ac9e038f9b3926a604c..b9d53b53d7698c823cf1b87c268e06b0c96364f7 100644 (file)
@@ -26,7 +26,7 @@ static const struct file_operations proc_sys_dir_file_operations;
 static const struct inode_operations proc_sys_dir_operations;
 
 /* shared constants to be used in various sysctls */
-const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
+const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX, 65535 };
 EXPORT_SYMBOL(sysctl_vals);
 
 const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
index 2de6d20d191bac2e3e89b9fde6de8d4ccbd1034b..bb921eb8a02d4ff62cb5c67b4dc4818b082cb967 100644 (file)
@@ -49,6 +49,9 @@ struct ctl_dir;
 #define SYSCTL_THREE_THOUSAND          ((void *)&sysctl_vals[8])
 #define SYSCTL_INT_MAX                 ((void *)&sysctl_vals[9])
 
+/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
+#define SYSCTL_MAXOLDUID               ((void *)&sysctl_vals[10])
+
 extern const int sysctl_vals[];
 
 #define SYSCTL_LONG_ZERO       ((void *)&sysctl_long_vals[0])
index 4d182fb5c22e48141b3497997cc98982ee2fc4ca..5bbb4c59dd1a1cec6280045a7cb2d1d3f73b9cc1 100644 (file)
@@ -110,10 +110,6 @@ static const int six_hundred_forty_kb = 640 * 1024;
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
-/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
-static const int maxolduid = 65535;
-/* minolduid is SYSCTL_ZERO */
-
 static const int ngroups_max = NGROUPS_MAX;
 static const int cap_last_cap = CAP_LAST_CAP;
 
@@ -2127,7 +2123,7 @@ static struct ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = (void *)&maxolduid,
+               .extra2         = SYSCTL_MAXOLDUID,
        },
        {
                .procname       = "overflowgid",
@@ -2136,7 +2132,7 @@ static struct ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = (void *)&maxolduid,
+               .extra2         = SYSCTL_MAXOLDUID,
        },
 #ifdef CONFIG_S390
        {
@@ -2908,7 +2904,7 @@ static struct ctl_table fs_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = (void *)&maxolduid,
+               .extra2         = SYSCTL_MAXOLDUID,
        },
        {
                .procname       = "overflowgid",
@@ -2917,7 +2913,7 @@ static struct ctl_table fs_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = (void *)&maxolduid,
+               .extra2         = SYSCTL_MAXOLDUID,
        },
 #ifdef CONFIG_FILE_LOCKING
        {