History

sysctl: move maxolduid as a sysctl specific const

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]

Luis Chamberlain committed 4 years ago

Commit 54771611 parent c8c0c233 files · +8 −9Browse files

Unified · Split

3 files
  1. fs/proc/proc_sysctl.c +1 −1
  2. include/linux/sysctl.h +3 −0
  3. kernel/sysctl.c +4 −8
fs/proc/proc_sysctl.c+1−1
@@ -26,7 +26,7 @@ static const struct file_operations proc_sys_dir_file_operations; · 25 unmodified lines
2626 static const struct inode_operations proc_sys_dir_operations;
2727
2828 /* shared constants to be used in various sysctls */
29−const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };
29+const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX, 65535 };
3030 EXPORT_SYMBOL(sysctl_vals);
3131
3232 const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
include/linux/sysctl.h+3−0
@@ -49,6 +49,9 @@ struct ctl_dir; · 48 unmodified lines
4949 #define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8])
5050 #define SYSCTL_INT_MAX ((void *)&sysctl_vals[9])
5151
52+/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
53+#define SYSCTL_MAXOLDUID ((void *)&sysctl_vals[10])
54+
5255 extern const int sysctl_vals[];
5356
5457 #define SYSCTL_LONG_ZERO ((void *)&sysctl_long_vals[0])
kernel/sysctl.c+4−8
@@ -110,10 +110,6 @@ static const int six_hundred_forty_kb = 640 * 1024; · 109 unmodified lines
110110 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
111111 static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
112112
113−/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
114−static const int maxolduid = 65535;
115−/* minolduid is SYSCTL_ZERO */
116−
117113 static const int ngroups_max = NGROUPS_MAX;
118114 static const int cap_last_cap = CAP_LAST_CAP;
119115
@@ -2127,7 +2123,7 @@ static struct ctl_table kern_table[] = { · 2007 unmodified lines
21272123 .mode = 0644,
21282124 .proc_handler = proc_dointvec_minmax,
21292125 .extra1 = SYSCTL_ZERO,
2130− .extra2 = (void *)&maxolduid,
2126+ .extra2 = SYSCTL_MAXOLDUID,
21312127 },
21322128 {
21332129 .procname = "overflowgid",
@@ -2136,7 +2132,7 @@ static struct ctl_table kern_table[] = { · 2 unmodified lines
21362132 .mode = 0644,
21372133 .proc_handler = proc_dointvec_minmax,
21382134 .extra1 = SYSCTL_ZERO,
2139− .extra2 = (void *)&maxolduid,
2135+ .extra2 = SYSCTL_MAXOLDUID,
21402136 },
21412137 #ifdef CONFIG_S390
21422138 {
@@ -2908,7 +2904,7 @@ static struct ctl_table fs_table[] = { · 765 unmodified lines
29082904 .mode = 0644,
29092905 .proc_handler = proc_dointvec_minmax,
29102906 .extra1 = SYSCTL_ZERO,
2911− .extra2 = (void *)&maxolduid,
2907+ .extra2 = SYSCTL_MAXOLDUID,
29122908 },
29132909 {
29142910 .procname = "overflowgid",
@@ -2917,7 +2913,7 @@ static struct ctl_table fs_table[] = { · 2 unmodified lines
29172913 .mode = 0644,
29182914 .proc_handler = proc_dointvec_minmax,
29192915 .extra1 = SYSCTL_ZERO,
2920− .extra2 = (void *)&maxolduid,
2916+ .extra2 = SYSCTL_MAXOLDUID,
29212917 },
29222918 #ifdef CONFIG_FILE_LOCKING
29232919 {