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
26static const struct inode_operations proc_sys_dir_operations;26static const struct inode_operations proc_sys_dir_operations;
27 27
28/* shared constants to be used in various sysctls */28/* shared constants to be used in various sysctls */
29const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX };29const int sysctl_vals[] = { -1, 0, 1, 2, 4, 100, 200, 1000, 3000, INT_MAX, 65535 };
30EXPORT_SYMBOL(sysctl_vals);30EXPORT_SYMBOL(sysctl_vals);
31 31
32const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };32const 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
49#define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8])49#define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8])
50#define SYSCTL_INT_MAX ((void *)&sysctl_vals[9])50#define SYSCTL_INT_MAX ((void *)&sysctl_vals[9])
51 51
52/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
53#define SYSCTL_MAXOLDUID ((void *)&sysctl_vals[10])
54
52extern const int sysctl_vals[];55extern const int sysctl_vals[];
53 56
54#define SYSCTL_LONG_ZERO ((void *)&sysctl_long_vals[0])57#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
110/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */110/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
111static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;111static const unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
112 112
113/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
114static const int maxolduid = 65535;
115/* minolduid is SYSCTL_ZERO */
116
117static const int ngroups_max = NGROUPS_MAX;113static const int ngroups_max = NGROUPS_MAX;
118static const int cap_last_cap = CAP_LAST_CAP;114static const int cap_last_cap = CAP_LAST_CAP;
119 115
@@ -2127,7 +2123,7 @@ static struct ctl_table kern_table[] = { · 2007 unmodified lines
2127 .mode = 0644,2123 .mode = 0644,
2128 .proc_handler = proc_dointvec_minmax,2124 .proc_handler = proc_dointvec_minmax,
2129 .extra1 = SYSCTL_ZERO,2125 .extra1 = SYSCTL_ZERO,
2130 .extra2 = (void *)&maxolduid,2126 .extra2 = SYSCTL_MAXOLDUID,
2131 },2127 },
2132 {2128 {
2133 .procname = "overflowgid",2129 .procname = "overflowgid",
@@ -2136,7 +2132,7 @@ static struct ctl_table kern_table[] = { · 2 unmodified lines
2136 .mode = 0644,2132 .mode = 0644,
2137 .proc_handler = proc_dointvec_minmax,2133 .proc_handler = proc_dointvec_minmax,
2138 .extra1 = SYSCTL_ZERO,2134 .extra1 = SYSCTL_ZERO,
2139 .extra2 = (void *)&maxolduid,2135 .extra2 = SYSCTL_MAXOLDUID,
2140 },2136 },
2141#ifdef CONFIG_S3902137#ifdef CONFIG_S390
2142 {2138 {
@@ -2908,7 +2904,7 @@ static struct ctl_table fs_table[] = { · 765 unmodified lines
2908 .mode = 0644,2904 .mode = 0644,
2909 .proc_handler = proc_dointvec_minmax,2905 .proc_handler = proc_dointvec_minmax,
2910 .extra1 = SYSCTL_ZERO,2906 .extra1 = SYSCTL_ZERO,
2911 .extra2 = (void *)&maxolduid,2907 .extra2 = SYSCTL_MAXOLDUID,
2912 },2908 },
2913 {2909 {
2914 .procname = "overflowgid",2910 .procname = "overflowgid",
@@ -2917,7 +2913,7 @@ static struct ctl_table fs_table[] = { · 2 unmodified lines
2917 .mode = 0644,2913 .mode = 0644,
2918 .proc_handler = proc_dointvec_minmax,2914 .proc_handler = proc_dointvec_minmax,
2919 .extra1 = SYSCTL_ZERO,2915 .extra1 = SYSCTL_ZERO,
2920 .extra2 = (void *)&maxolduid,2916 .extra2 = SYSCTL_MAXOLDUID,
2921 },2917 },
2922#ifdef CONFIG_FILE_LOCKING2918#ifdef CONFIG_FILE_LOCKING
2923 {2919 {