summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@redhat.com>2019-07-18 18:58:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-18 20:08:07 -0400
commiteec4844fae7c033a0c1fc1eb3b8517aeb8b6cc49 (patch)
treea7da379423835a85c020e116a43bea6acf3c9ace
parent371096949f0ad3950b06729989bd27de51b8c5f5 (diff)
proc/sysctl: add shared variables for range check
In the sysctl code the proc_dointvec_minmax() function is often used to validate the user supplied value between an allowed range. This function uses the extra1 and extra2 members from struct ctl_table as minimum and maximum allowed value. On sysctl handler declaration, in every source file there are some readonly variables containing just an integer which address is assigned to the extra1 and extra2 members, so the sysctl range is enforced. The special values 0, 1 and INT_MAX are very often used as range boundary, leading duplication of variables like zero=0, one=1, int_max=INT_MAX in different source files: $ git grep -E '\.extra[12].*&(zero|one|int_max)' |wc -l 248 Add a const int array containing the most commonly used values, some macros to refer more easily to the correct array member, and use them instead of creating a local one for every object file. This is the bloat-o-meter output comparing the old and new binary compiled with the default Fedora config: # scripts/bloat-o-meter -d vmlinux.o.old vmlinux.o add/remove: 2/2 grow/shrink: 0/2 up/down: 24/-188 (-164) Data old new delta sysctl_vals - 12 +12 __kstrtab_sysctl_vals - 12 +12 max 14 10 -4 int_max 16 - -16 one 68 - -68 zero 128 28 -100 Total: Before=20583249, After=20583085, chg -0.00% [mcroce@redhat.com: tipc: remove two unused variables] Link: http://lkml.kernel.org/r/20190530091952.4108-1-mcroce@redhat.com [akpm@linux-foundation.org: fix net/ipv6/sysctl_net_ipv6.c] [arnd@arndb.de: proc/sysctl: make firmware loader table conditional] Link: http://lkml.kernel.org/r/20190617130014.1713870-1-arnd@arndb.de [akpm@linux-foundation.org: fix fs/eventpoll.c] Link: http://lkml.kernel.org/r/20190430180111.10688-1-mcroce@redhat.com Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Kees Cook <keescook@chromium.org> Reviewed-by: Aaron Tomlin <atomlin@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/s390/appldata/appldata_base.c15
-rw-r--r--arch/s390/kernel/topology.c6
-rw-r--r--arch/x86/entry/vdso/vdso32-setup.c7
-rw-r--r--arch/x86/kernel/itmt.c6
-rw-r--r--drivers/base/firmware_loader/fallback_table.c13
-rw-r--r--drivers/gpu/drm/i915/i915_perf.c8
-rw-r--r--drivers/hv/vmbus_drv.c6
-rw-r--r--drivers/tty/tty_ldisc.c6
-rw-r--r--drivers/xen/balloon.c7
-rw-r--r--fs/eventpoll.c4
-rw-r--r--fs/notify/inotify/inotify_user.c8
-rw-r--r--fs/proc/proc_sysctl.c4
-rw-r--r--include/linux/sysctl.h7
-rw-r--r--ipc/ipc_sysctl.c35
-rw-r--r--kernel/pid_namespace.c3
-rw-r--r--kernel/sysctl.c197
-rw-r--r--kernel/ucount.c6
-rw-r--r--net/core/neighbour.c20
-rw-r--r--net/core/sysctl_net_core.c34
-rw-r--r--net/dccp/sysctl.c16
-rw-r--r--net/ipv4/sysctl_net_ipv4.c60
-rw-r--r--net/ipv6/addrconf.c6
-rw-r--r--net/ipv6/route.c7
-rw-r--r--net/ipv6/sysctl_net_ipv6.c10
-rw-r--r--net/mpls/af_mpls.c10
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c3
-rw-r--r--net/rxrpc/sysctl.c9
-rw-r--r--net/sctp/sysctl.c35
-rw-r--r--net/sunrpc/xprtrdma/transport.c3
-rw-r--r--net/tipc/sysctl.c6
-rw-r--r--security/keys/sysctl.c26
-rw-r--r--security/loadpin/loadpin.c6
-rw-r--r--security/yama/yama_lsm.c3
33 files changed, 270 insertions, 322 deletions
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index e4b58240ec53..aa738cad1338 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -220,15 +220,13 @@ appldata_timer_handler(struct ctl_table *ctl, int write,
220 void __user *buffer, size_t *lenp, loff_t *ppos) 220 void __user *buffer, size_t *lenp, loff_t *ppos)
221{ 221{
222 int timer_active = appldata_timer_active; 222 int timer_active = appldata_timer_active;
223 int zero = 0;
224 int one = 1;
225 int rc; 223 int rc;
226 struct ctl_table ctl_entry = { 224 struct ctl_table ctl_entry = {
227 .procname = ctl->procname, 225 .procname = ctl->procname,
228 .data = &timer_active, 226 .data = &timer_active,
229 .maxlen = sizeof(int), 227 .maxlen = sizeof(int),
230 .extra1 = &zero, 228 .extra1 = SYSCTL_ZERO,
231 .extra2 = &one, 229 .extra2 = SYSCTL_ONE,
232 }; 230 };
233 231
234 rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos); 232 rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
@@ -255,13 +253,12 @@ appldata_interval_handler(struct ctl_table *ctl, int write,
255 void __user *buffer, size_t *lenp, loff_t *ppos) 253 void __user *buffer, size_t *lenp, loff_t *ppos)
256{ 254{
257 int interval = appldata_interval; 255 int interval = appldata_interval;
258 int one = 1;
259 int rc; 256 int rc;
260 struct ctl_table ctl_entry = { 257 struct ctl_table ctl_entry = {
261 .procname = ctl->procname, 258 .procname = ctl->procname,
262 .data = &interval, 259 .data = &interval,
263 .maxlen = sizeof(int), 260 .maxlen = sizeof(int),
264 .extra1 = &one, 261 .extra1 = SYSCTL_ONE,
265 }; 262 };
266 263
267 rc = proc_dointvec_minmax(&ctl_entry, write, buffer, lenp, ppos); 264 rc = proc_dointvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
@@ -289,13 +286,11 @@ appldata_generic_handler(struct ctl_table *ctl, int write,
289 struct list_head *lh; 286 struct list_head *lh;
290 int rc, found; 287 int rc, found;
291 int active; 288 int active;
292 int zero = 0;
293 int one = 1;
294 struct ctl_table ctl_entry = { 289 struct ctl_table ctl_entry = {
295 .data = &active, 290 .data = &active,
296 .maxlen = sizeof(int), 291 .maxlen = sizeof(int),
297 .extra1 = &zero, 292 .extra1 = SYSCTL_ZERO,
298 .extra2 = &one, 293 .extra2 = SYSCTL_ONE,
299 }; 294 };
300 295
301 found = 0; 296 found = 0;
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 8964a3f60aad..2db6fb405a9a 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -587,15 +587,13 @@ static int topology_ctl_handler(struct ctl_table *ctl, int write,
587{ 587{
588 int enabled = topology_is_enabled(); 588 int enabled = topology_is_enabled();
589 int new_mode; 589 int new_mode;
590 int zero = 0;
591 int one = 1;
592 int rc; 590 int rc;
593 struct ctl_table ctl_entry = { 591 struct ctl_table ctl_entry = {
594 .procname = ctl->procname, 592 .procname = ctl->procname,
595 .data = &enabled, 593 .data = &enabled,
596 .maxlen = sizeof(int), 594 .maxlen = sizeof(int),
597 .extra1 = &zero, 595 .extra1 = SYSCTL_ZERO,
598 .extra2 = &one, 596 .extra2 = SYSCTL_ONE,
599 }; 597 };
600 598
601 rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos); 599 rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
index 42d4c89f990e..240626e7f55a 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -65,9 +65,6 @@ subsys_initcall(sysenter_setup);
65/* Register vsyscall32 into the ABI table */ 65/* Register vsyscall32 into the ABI table */
66#include <linux/sysctl.h> 66#include <linux/sysctl.h>
67 67
68static const int zero;
69static const int one = 1;
70
71static struct ctl_table abi_table2[] = { 68static struct ctl_table abi_table2[] = {
72 { 69 {
73 .procname = "vsyscall32", 70 .procname = "vsyscall32",
@@ -75,8 +72,8 @@ static struct ctl_table abi_table2[] = {
75 .maxlen = sizeof(int), 72 .maxlen = sizeof(int),
76 .mode = 0644, 73 .mode = 0644,
77 .proc_handler = proc_dointvec_minmax, 74 .proc_handler = proc_dointvec_minmax,
78 .extra1 = (int *)&zero, 75 .extra1 = SYSCTL_ZERO,
79 .extra2 = (int *)&one, 76 .extra2 = SYSCTL_ONE,
80 }, 77 },
81 {} 78 {}
82}; 79};
diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index 838cf8a32c49..1cb3ca9bba49 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -65,8 +65,6 @@ static int sched_itmt_update_handler(struct ctl_table *table, int write,
65 return ret; 65 return ret;
66} 66}
67 67
68static unsigned int zero;
69static unsigned int one = 1;
70static struct ctl_table itmt_kern_table[] = { 68static struct ctl_table itmt_kern_table[] = {
71 { 69 {
72 .procname = "sched_itmt_enabled", 70 .procname = "sched_itmt_enabled",
@@ -74,8 +72,8 @@ static struct ctl_table itmt_kern_table[] = {
74 .maxlen = sizeof(unsigned int), 72 .maxlen = sizeof(unsigned int),
75 .mode = 0644, 73 .mode = 0644,
76 .proc_handler = sched_itmt_update_handler, 74 .proc_handler = sched_itmt_update_handler,
77 .extra1 = &zero, 75 .extra1 = SYSCTL_ZERO,
78 .extra2 = &one, 76 .extra2 = SYSCTL_ONE,
79 }, 77 },
80 {} 78 {}
81}; 79};
diff --git a/drivers/base/firmware_loader/fallback_table.c b/drivers/base/firmware_loader/fallback_table.c
index 776dd69cf5be..ba9d30b28edc 100644
--- a/drivers/base/firmware_loader/fallback_table.c
+++ b/drivers/base/firmware_loader/fallback_table.c
@@ -16,9 +16,6 @@
16 * firmware fallback configuration table 16 * firmware fallback configuration table
17 */ 17 */
18 18
19static unsigned int zero;
20static unsigned int one = 1;
21
22struct firmware_fallback_config fw_fallback_config = { 19struct firmware_fallback_config fw_fallback_config = {
23 .force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK), 20 .force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
24 .loading_timeout = 60, 21 .loading_timeout = 60,
@@ -26,6 +23,7 @@ struct firmware_fallback_config fw_fallback_config = {
26}; 23};
27EXPORT_SYMBOL_GPL(fw_fallback_config); 24EXPORT_SYMBOL_GPL(fw_fallback_config);
28 25
26#ifdef CONFIG_SYSCTL
29struct ctl_table firmware_config_table[] = { 27struct ctl_table firmware_config_table[] = {
30 { 28 {
31 .procname = "force_sysfs_fallback", 29 .procname = "force_sysfs_fallback",
@@ -33,8 +31,8 @@ struct ctl_table firmware_config_table[] = {
33 .maxlen = sizeof(unsigned int), 31 .maxlen = sizeof(unsigned int),
34 .mode = 0644, 32 .mode = 0644,
35 .proc_handler = proc_douintvec_minmax, 33 .proc_handler = proc_douintvec_minmax,
36 .extra1 = &zero, 34 .extra1 = SYSCTL_ZERO,
37 .extra2 = &one, 35 .extra2 = SYSCTL_ONE,
38 }, 36 },
39 { 37 {
40 .procname = "ignore_sysfs_fallback", 38 .procname = "ignore_sysfs_fallback",
@@ -42,9 +40,10 @@ struct ctl_table firmware_config_table[] = {
42 .maxlen = sizeof(unsigned int), 40 .maxlen = sizeof(unsigned int),
43 .mode = 0644, 41 .mode = 0644,
44 .proc_handler = proc_douintvec_minmax, 42 .proc_handler = proc_douintvec_minmax,
45 .extra1 = &zero, 43 .extra1 = SYSCTL_ZERO,
46 .extra2 = &one, 44 .extra2 = SYSCTL_ONE,
47 }, 45 },
48 { } 46 { }
49}; 47};
50EXPORT_SYMBOL_GPL(firmware_config_table); 48EXPORT_SYMBOL_GPL(firmware_config_table);
49#endif
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 3d8162d28730..a700c5c3d167 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -274,8 +274,6 @@
274#define POLL_PERIOD (NSEC_PER_SEC / POLL_FREQUENCY) 274#define POLL_PERIOD (NSEC_PER_SEC / POLL_FREQUENCY)
275 275
276/* for sysctl proc_dointvec_minmax of dev.i915.perf_stream_paranoid */ 276/* for sysctl proc_dointvec_minmax of dev.i915.perf_stream_paranoid */
277static int zero;
278static int one = 1;
279static u32 i915_perf_stream_paranoid = true; 277static u32 i915_perf_stream_paranoid = true;
280 278
281/* The maximum exponent the hardware accepts is 63 (essentially it selects one 279/* The maximum exponent the hardware accepts is 63 (essentially it selects one
@@ -3366,8 +3364,8 @@ static struct ctl_table oa_table[] = {
3366 .maxlen = sizeof(i915_perf_stream_paranoid), 3364 .maxlen = sizeof(i915_perf_stream_paranoid),
3367 .mode = 0644, 3365 .mode = 0644,
3368 .proc_handler = proc_dointvec_minmax, 3366 .proc_handler = proc_dointvec_minmax,
3369 .extra1 = &zero, 3367 .extra1 = SYSCTL_ZERO,
3370 .extra2 = &one, 3368 .extra2 = SYSCTL_ONE,
3371 }, 3369 },
3372 { 3370 {
3373 .procname = "oa_max_sample_rate", 3371 .procname = "oa_max_sample_rate",
@@ -3375,7 +3373,7 @@ static struct ctl_table oa_table[] = {
3375 .maxlen = sizeof(i915_oa_max_sample_rate), 3373 .maxlen = sizeof(i915_oa_max_sample_rate),
3376 .mode = 0644, 3374 .mode = 0644,
3377 .proc_handler = proc_dointvec_minmax, 3375 .proc_handler = proc_dointvec_minmax,
3378 .extra1 = &zero, 3376 .extra1 = SYSCTL_ZERO,
3379 .extra2 = &oa_sample_rate_hard_limit, 3377 .extra2 = &oa_sample_rate_hard_limit,
3380 }, 3378 },
3381 {} 3379 {}
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 894da5abdc55..ebd35fc35290 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1197,8 +1197,6 @@ static struct kmsg_dumper hv_kmsg_dumper = {
1197}; 1197};
1198 1198
1199static struct ctl_table_header *hv_ctl_table_hdr; 1199static struct ctl_table_header *hv_ctl_table_hdr;
1200static int zero;
1201static int one = 1;
1202 1200
1203/* 1201/*
1204 * sysctl option to allow the user to control whether kmsg data should be 1202 * sysctl option to allow the user to control whether kmsg data should be
@@ -1211,8 +1209,8 @@ static struct ctl_table hv_ctl_table[] = {
1211 .maxlen = sizeof(int), 1209 .maxlen = sizeof(int),
1212 .mode = 0644, 1210 .mode = 0644,
1213 .proc_handler = proc_dointvec_minmax, 1211 .proc_handler = proc_dointvec_minmax,
1214 .extra1 = &zero, 1212 .extra1 = SYSCTL_ZERO,
1215 .extra2 = &one 1213 .extra2 = SYSCTL_ONE
1216 }, 1214 },
1217 {} 1215 {}
1218}; 1216};
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index fde8d4073e74..4c49f53afa3e 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -855,8 +855,6 @@ void tty_ldisc_deinit(struct tty_struct *tty)
855 tty->ldisc = NULL; 855 tty->ldisc = NULL;
856} 856}
857 857
858static int zero;
859static int one = 1;
860static struct ctl_table tty_table[] = { 858static struct ctl_table tty_table[] = {
861 { 859 {
862 .procname = "ldisc_autoload", 860 .procname = "ldisc_autoload",
@@ -864,8 +862,8 @@ static struct ctl_table tty_table[] = {
864 .maxlen = sizeof(tty_ldisc_autoload), 862 .maxlen = sizeof(tty_ldisc_autoload),
865 .mode = 0644, 863 .mode = 0644,
866 .proc_handler = proc_dointvec, 864 .proc_handler = proc_dointvec,
867 .extra1 = &zero, 865 .extra1 = SYSCTL_ZERO,
868 .extra2 = &one, 866 .extra2 = SYSCTL_ONE,
869 }, 867 },
870 { } 868 { }
871}; 869};
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index d37dd5bb7a8f..37a36c6b9f93 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -77,9 +77,6 @@ static int xen_hotplug_unpopulated;
77 77
78#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG 78#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
79 79
80static int zero;
81static int one = 1;
82
83static struct ctl_table balloon_table[] = { 80static struct ctl_table balloon_table[] = {
84 { 81 {
85 .procname = "hotplug_unpopulated", 82 .procname = "hotplug_unpopulated",
@@ -87,8 +84,8 @@ static struct ctl_table balloon_table[] = {
87 .maxlen = sizeof(int), 84 .maxlen = sizeof(int),
88 .mode = 0644, 85 .mode = 0644,
89 .proc_handler = proc_dointvec_minmax, 86 .proc_handler = proc_dointvec_minmax,
90 .extra1 = &zero, 87 .extra1 = SYSCTL_ZERO,
91 .extra2 = &one, 88 .extra2 = SYSCTL_ONE,
92 }, 89 },
93 { } 90 { }
94}; 91};
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0f9c073d78d5..d7f1f5011fac 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -291,7 +291,7 @@ static LIST_HEAD(tfile_check_list);
291 291
292#include <linux/sysctl.h> 292#include <linux/sysctl.h>
293 293
294static long zero; 294static long long_zero;
295static long long_max = LONG_MAX; 295static long long_max = LONG_MAX;
296 296
297struct ctl_table epoll_table[] = { 297struct ctl_table epoll_table[] = {
@@ -301,7 +301,7 @@ struct ctl_table epoll_table[] = {
301 .maxlen = sizeof(max_user_watches), 301 .maxlen = sizeof(max_user_watches),
302 .mode = 0644, 302 .mode = 0644,
303 .proc_handler = proc_doulongvec_minmax, 303 .proc_handler = proc_doulongvec_minmax,
304 .extra1 = &zero, 304 .extra1 = &long_zero,
305 .extra2 = &long_max, 305 .extra2 = &long_max,
306 }, 306 },
307 { } 307 { }
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index cce8de32779f..0b815178126e 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -45,8 +45,6 @@ struct kmem_cache *inotify_inode_mark_cachep __read_mostly;
45 45
46#include <linux/sysctl.h> 46#include <linux/sysctl.h>
47 47
48static int zero;
49
50struct ctl_table inotify_table[] = { 48struct ctl_table inotify_table[] = {
51 { 49 {
52 .procname = "max_user_instances", 50 .procname = "max_user_instances",
@@ -54,7 +52,7 @@ struct ctl_table inotify_table[] = {
54 .maxlen = sizeof(int), 52 .maxlen = sizeof(int),
55 .mode = 0644, 53 .mode = 0644,
56 .proc_handler = proc_dointvec_minmax, 54 .proc_handler = proc_dointvec_minmax,
57 .extra1 = &zero, 55 .extra1 = SYSCTL_ZERO,
58 }, 56 },
59 { 57 {
60 .procname = "max_user_watches", 58 .procname = "max_user_watches",
@@ -62,7 +60,7 @@ struct ctl_table inotify_table[] = {
62 .maxlen = sizeof(int), 60 .maxlen = sizeof(int),
63 .mode = 0644, 61 .mode = 0644,
64 .proc_handler = proc_dointvec_minmax, 62 .proc_handler = proc_dointvec_minmax,
65 .extra1 = &zero, 63 .extra1 = SYSCTL_ZERO,
66 }, 64 },
67 { 65 {
68 .procname = "max_queued_events", 66 .procname = "max_queued_events",
@@ -70,7 +68,7 @@ struct ctl_table inotify_table[] = {
70 .maxlen = sizeof(int), 68 .maxlen = sizeof(int),
71 .mode = 0644, 69 .mode = 0644,
72 .proc_handler = proc_dointvec_minmax, 70 .proc_handler = proc_dointvec_minmax,
73 .extra1 = &zero 71 .extra1 = SYSCTL_ZERO
74 }, 72 },
75 { } 73 { }
76}; 74};
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 36ad1b0d6259..d80989b6c344 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -22,6 +22,10 @@ static const struct inode_operations proc_sys_inode_operations;
22static const struct file_operations proc_sys_dir_file_operations; 22static const struct file_operations proc_sys_dir_file_operations;
23static const struct inode_operations proc_sys_dir_operations; 23static const struct inode_operations proc_sys_dir_operations;
24 24
25/* shared constants to be used in various sysctls */
26const int sysctl_vals[] = { 0, 1, INT_MAX };
27EXPORT_SYMBOL(sysctl_vals);
28
25/* Support for permanently empty directories */ 29/* Support for permanently empty directories */
26 30
27struct ctl_table sysctl_mount_point[] = { 31struct ctl_table sysctl_mount_point[] = {
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index aadd310769d0..6df477329b76 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -37,6 +37,13 @@ struct ctl_table_root;
37struct ctl_table_header; 37struct ctl_table_header;
38struct ctl_dir; 38struct ctl_dir;
39 39
40/* Keep the same order as in fs/proc/proc_sysctl.c */
41#define SYSCTL_ZERO ((void *)&sysctl_vals[0])
42#define SYSCTL_ONE ((void *)&sysctl_vals[1])
43#define SYSCTL_INT_MAX ((void *)&sysctl_vals[2])
44
45extern const int sysctl_vals[];
46
40typedef int proc_handler (struct ctl_table *ctl, int write, 47typedef int proc_handler (struct ctl_table *ctl, int write,
41 void __user *buffer, size_t *lenp, loff_t *ppos); 48 void __user *buffer, size_t *lenp, loff_t *ppos);
42 49
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 2b14ce8ce73f..affd66537e87 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -113,9 +113,6 @@ static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
113#define proc_ipc_sem_dointvec NULL 113#define proc_ipc_sem_dointvec NULL
114#endif 114#endif
115 115
116static int zero;
117static int one = 1;
118static int int_max = INT_MAX;
119int ipc_mni = IPCMNI; 116int ipc_mni = IPCMNI;
120int ipc_mni_shift = IPCMNI_SHIFT; 117int ipc_mni_shift = IPCMNI_SHIFT;
121int ipc_min_cycle = RADIX_TREE_MAP_SIZE; 118int ipc_min_cycle = RADIX_TREE_MAP_SIZE;
@@ -141,7 +138,7 @@ static struct ctl_table ipc_kern_table[] = {
141 .maxlen = sizeof(init_ipc_ns.shm_ctlmni), 138 .maxlen = sizeof(init_ipc_ns.shm_ctlmni),
142 .mode = 0644, 139 .mode = 0644,
143 .proc_handler = proc_ipc_dointvec_minmax, 140 .proc_handler = proc_ipc_dointvec_minmax,
144 .extra1 = &zero, 141 .extra1 = SYSCTL_ZERO,
145 .extra2 = &ipc_mni, 142 .extra2 = &ipc_mni,
146 }, 143 },
147 { 144 {
@@ -150,8 +147,8 @@ static struct ctl_table ipc_kern_table[] = {
150 .maxlen = sizeof(init_ipc_ns.shm_rmid_forced), 147 .maxlen = sizeof(init_ipc_ns.shm_rmid_forced),
151 .mode = 0644, 148 .mode = 0644,
152 .proc_handler = proc_ipc_dointvec_minmax_orphans, 149 .proc_handler = proc_ipc_dointvec_minmax_orphans,
153 .extra1 = &zero, 150 .extra1 = SYSCTL_ZERO,
154 .extra2 = &one, 151 .extra2 = SYSCTL_ONE,
155 }, 152 },
156 { 153 {
157 .procname = "msgmax", 154 .procname = "msgmax",
@@ -159,8 +156,8 @@ static struct ctl_table ipc_kern_table[] = {
159 .maxlen = sizeof(init_ipc_ns.msg_ctlmax), 156 .maxlen = sizeof(init_ipc_ns.msg_ctlmax),
160 .mode = 0644, 157 .mode = 0644,
161 .proc_handler = proc_ipc_dointvec_minmax, 158 .proc_handler = proc_ipc_dointvec_minmax,
162 .extra1 = &zero, 159 .extra1 = SYSCTL_ZERO,
163 .extra2 = &int_max, 160 .extra2 = SYSCTL_INT_MAX,
164 }, 161 },
165 { 162 {
166 .procname = "msgmni", 163 .procname = "msgmni",
@@ -168,7 +165,7 @@ static struct ctl_table ipc_kern_table[] = {
168 .maxlen = sizeof(init_ipc_ns.msg_ctlmni), 165 .maxlen = sizeof(init_ipc_ns.msg_ctlmni),
169 .mode = 0644, 166 .mode = 0644,
170 .proc_handler = proc_ipc_dointvec_minmax, 167 .proc_handler = proc_ipc_dointvec_minmax,
171 .extra1 = &zero, 168 .extra1 = SYSCTL_ZERO,
172 .extra2 = &ipc_mni, 169 .extra2 = &ipc_mni,
173 }, 170 },
174 { 171 {
@@ -177,8 +174,8 @@ static struct ctl_table ipc_kern_table[] = {
177 .maxlen = sizeof(int), 174 .maxlen = sizeof(int),
178 .mode = 0644, 175 .mode = 0644,
179 .proc_handler = proc_ipc_auto_msgmni, 176 .proc_handler = proc_ipc_auto_msgmni,
180 .extra1 = &zero, 177 .extra1 = SYSCTL_ZERO,
181 .extra2 = &one, 178 .extra2 = SYSCTL_ONE,
182 }, 179 },
183 { 180 {
184 .procname = "msgmnb", 181 .procname = "msgmnb",
@@ -186,8 +183,8 @@ static struct ctl_table ipc_kern_table[] = {
186 .maxlen = sizeof(init_ipc_ns.msg_ctlmnb), 183 .maxlen = sizeof(init_ipc_ns.msg_ctlmnb),
187 .mode = 0644, 184 .mode = 0644,
188 .proc_handler = proc_ipc_dointvec_minmax, 185 .proc_handler = proc_ipc_dointvec_minmax,
189 .extra1 = &zero, 186 .extra1 = SYSCTL_ZERO,
190 .extra2 = &int_max, 187 .extra2 = SYSCTL_INT_MAX,
191 }, 188 },
192 { 189 {
193 .procname = "sem", 190 .procname = "sem",
@@ -203,8 +200,8 @@ static struct ctl_table ipc_kern_table[] = {
203 .maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id), 200 .maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id),
204 .mode = 0644, 201 .mode = 0644,
205 .proc_handler = proc_ipc_dointvec_minmax, 202 .proc_handler = proc_ipc_dointvec_minmax,
206 .extra1 = &zero, 203 .extra1 = SYSCTL_ZERO,
207 .extra2 = &int_max, 204 .extra2 = SYSCTL_INT_MAX,
208 }, 205 },
209 { 206 {
210 .procname = "msg_next_id", 207 .procname = "msg_next_id",
@@ -212,8 +209,8 @@ static struct ctl_table ipc_kern_table[] = {
212 .maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id), 209 .maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id),
213 .mode = 0644, 210 .mode = 0644,
214 .proc_handler = proc_ipc_dointvec_minmax, 211 .proc_handler = proc_ipc_dointvec_minmax,
215 .extra1 = &zero, 212 .extra1 = SYSCTL_ZERO,
216 .extra2 = &int_max, 213 .extra2 = SYSCTL_INT_MAX,
217 }, 214 },
218 { 215 {
219 .procname = "shm_next_id", 216 .procname = "shm_next_id",
@@ -221,8 +218,8 @@ static struct ctl_table ipc_kern_table[] = {
221 .maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id), 218 .maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id),
222 .mode = 0644, 219 .mode = 0644,
223 .proc_handler = proc_ipc_dointvec_minmax, 220 .proc_handler = proc_ipc_dointvec_minmax,
224 .extra1 = &zero, 221 .extra1 = SYSCTL_ZERO,
225 .extra2 = &int_max, 222 .extra2 = SYSCTL_INT_MAX,
226 }, 223 },
227#endif 224#endif
228 {} 225 {}
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 6d726cef241c..a6a79f85c81a 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -291,14 +291,13 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
291} 291}
292 292
293extern int pid_max; 293extern int pid_max;
294static int zero = 0;
295static struct ctl_table pid_ns_ctl_table[] = { 294static struct ctl_table pid_ns_ctl_table[] = {
296 { 295 {
297 .procname = "ns_last_pid", 296 .procname = "ns_last_pid",
298 .maxlen = sizeof(int), 297 .maxlen = sizeof(int),
299 .mode = 0666, /* permissions are checked in the handler */ 298 .mode = 0666, /* permissions are checked in the handler */
300 .proc_handler = pid_ns_ctl_handler, 299 .proc_handler = pid_ns_ctl_handler,
301 .extra1 = &zero, 300 .extra1 = SYSCTL_ZERO,
302 .extra2 = &pid_max, 301 .extra2 = &pid_max,
303 }, 302 },
304 { } 303 { }
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 43186ccfa139..078950d9605b 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -125,9 +125,6 @@ static int sixty = 60;
125#endif 125#endif
126 126
127static int __maybe_unused neg_one = -1; 127static int __maybe_unused neg_one = -1;
128
129static int zero;
130static int __maybe_unused one = 1;
131static int __maybe_unused two = 2; 128static int __maybe_unused two = 2;
132static int __maybe_unused four = 4; 129static int __maybe_unused four = 4;
133static unsigned long zero_ul; 130static unsigned long zero_ul;
@@ -385,8 +382,8 @@ static struct ctl_table kern_table[] = {
385 .maxlen = sizeof(unsigned int), 382 .maxlen = sizeof(unsigned int),
386 .mode = 0644, 383 .mode = 0644,
387 .proc_handler = sysctl_schedstats, 384 .proc_handler = sysctl_schedstats,
388 .extra1 = &zero, 385 .extra1 = SYSCTL_ZERO,
389 .extra2 = &one, 386 .extra2 = SYSCTL_ONE,
390 }, 387 },
391#endif /* CONFIG_SCHEDSTATS */ 388#endif /* CONFIG_SCHEDSTATS */
392#endif /* CONFIG_SMP */ 389#endif /* CONFIG_SMP */
@@ -418,7 +415,7 @@ static struct ctl_table kern_table[] = {
418 .maxlen = sizeof(unsigned int), 415 .maxlen = sizeof(unsigned int),
419 .mode = 0644, 416 .mode = 0644,
420 .proc_handler = proc_dointvec_minmax, 417 .proc_handler = proc_dointvec_minmax,
421 .extra1 = &one, 418 .extra1 = SYSCTL_ONE,
422 }, 419 },
423 { 420 {
424 .procname = "numa_balancing", 421 .procname = "numa_balancing",
@@ -426,8 +423,8 @@ static struct ctl_table kern_table[] = {
426 .maxlen = sizeof(unsigned int), 423 .maxlen = sizeof(unsigned int),
427 .mode = 0644, 424 .mode = 0644,
428 .proc_handler = sysctl_numa_balancing, 425 .proc_handler = sysctl_numa_balancing,
429 .extra1 = &zero, 426 .extra1 = SYSCTL_ZERO,
430 .extra2 = &one, 427 .extra2 = SYSCTL_ONE,
431 }, 428 },
432#endif /* CONFIG_NUMA_BALANCING */ 429#endif /* CONFIG_NUMA_BALANCING */
433#endif /* CONFIG_SCHED_DEBUG */ 430#endif /* CONFIG_SCHED_DEBUG */
@@ -475,8 +472,8 @@ static struct ctl_table kern_table[] = {
475 .maxlen = sizeof(unsigned int), 472 .maxlen = sizeof(unsigned int),
476 .mode = 0644, 473 .mode = 0644,
477 .proc_handler = proc_dointvec_minmax, 474 .proc_handler = proc_dointvec_minmax,
478 .extra1 = &zero, 475 .extra1 = SYSCTL_ZERO,
479 .extra2 = &one, 476 .extra2 = SYSCTL_ONE,
480 }, 477 },
481#endif 478#endif
482#ifdef CONFIG_CFS_BANDWIDTH 479#ifdef CONFIG_CFS_BANDWIDTH
@@ -486,7 +483,7 @@ static struct ctl_table kern_table[] = {
486 .maxlen = sizeof(unsigned int), 483 .maxlen = sizeof(unsigned int),
487 .mode = 0644, 484 .mode = 0644,
488 .proc_handler = proc_dointvec_minmax, 485 .proc_handler = proc_dointvec_minmax,
489 .extra1 = &one, 486 .extra1 = SYSCTL_ONE,
490 }, 487 },
491#endif 488#endif
492#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) 489#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
@@ -496,8 +493,8 @@ static struct ctl_table kern_table[] = {
496 .maxlen = sizeof(unsigned int), 493 .maxlen = sizeof(unsigned int),
497 .mode = 0644, 494 .mode = 0644,
498 .proc_handler = sched_energy_aware_handler, 495 .proc_handler = sched_energy_aware_handler,
499 .extra1 = &zero, 496 .extra1 = SYSCTL_ZERO,
500 .extra2 = &one, 497 .extra2 = SYSCTL_ONE,
501 }, 498 },
502#endif 499#endif
503#ifdef CONFIG_PROVE_LOCKING 500#ifdef CONFIG_PROVE_LOCKING
@@ -562,7 +559,7 @@ static struct ctl_table kern_table[] = {
562 .mode = 0644, 559 .mode = 0644,
563 .proc_handler = proc_dointvec_minmax, 560 .proc_handler = proc_dointvec_minmax,
564 .extra1 = &neg_one, 561 .extra1 = &neg_one,
565 .extra2 = &one, 562 .extra2 = SYSCTL_ONE,
566 }, 563 },
567#endif 564#endif
568#ifdef CONFIG_LATENCYTOP 565#ifdef CONFIG_LATENCYTOP
@@ -696,8 +693,8 @@ static struct ctl_table kern_table[] = {
696 .mode = 0644, 693 .mode = 0644,
697 /* only handle a transition from default "0" to "1" */ 694 /* only handle a transition from default "0" to "1" */
698 .proc_handler = proc_dointvec_minmax, 695 .proc_handler = proc_dointvec_minmax,
699 .extra1 = &one, 696 .extra1 = SYSCTL_ONE,
700 .extra2 = &one, 697 .extra2 = SYSCTL_ONE,
701 }, 698 },
702#endif 699#endif
703#ifdef CONFIG_MODULES 700#ifdef CONFIG_MODULES
@@ -715,8 +712,8 @@ static struct ctl_table kern_table[] = {
715 .mode = 0644, 712 .mode = 0644,
716 /* only handle a transition from default "0" to "1" */ 713 /* only handle a transition from default "0" to "1" */
717 .proc_handler = proc_dointvec_minmax, 714 .proc_handler = proc_dointvec_minmax,
718 .extra1 = &one, 715 .extra1 = SYSCTL_ONE,
719 .extra2 = &one, 716 .extra2 = SYSCTL_ONE,
720 }, 717 },
721#endif 718#endif
722#ifdef CONFIG_UEVENT_HELPER 719#ifdef CONFIG_UEVENT_HELPER
@@ -875,7 +872,7 @@ static struct ctl_table kern_table[] = {
875 .maxlen = sizeof(int), 872 .maxlen = sizeof(int),
876 .mode = 0644, 873 .mode = 0644,
877 .proc_handler = proc_dointvec_minmax, 874 .proc_handler = proc_dointvec_minmax,
878 .extra1 = &zero, 875 .extra1 = SYSCTL_ZERO,
879 .extra2 = &ten_thousand, 876 .extra2 = &ten_thousand,
880 }, 877 },
881 { 878 {
@@ -891,8 +888,8 @@ static struct ctl_table kern_table[] = {
891 .maxlen = sizeof(int), 888 .maxlen = sizeof(int),
892 .mode = 0644, 889 .mode = 0644,
893 .proc_handler = proc_dointvec_minmax_sysadmin, 890 .proc_handler = proc_dointvec_minmax_sysadmin,
894 .extra1 = &zero, 891 .extra1 = SYSCTL_ZERO,
895 .extra2 = &one, 892 .extra2 = SYSCTL_ONE,
896 }, 893 },
897 { 894 {
898 .procname = "kptr_restrict", 895 .procname = "kptr_restrict",
@@ -900,7 +897,7 @@ static struct ctl_table kern_table[] = {
900 .maxlen = sizeof(int), 897 .maxlen = sizeof(int),
901 .mode = 0644, 898 .mode = 0644,
902 .proc_handler = proc_dointvec_minmax_sysadmin, 899 .proc_handler = proc_dointvec_minmax_sysadmin,
903 .extra1 = &zero, 900 .extra1 = SYSCTL_ZERO,
904 .extra2 = &two, 901 .extra2 = &two,
905 }, 902 },
906#endif 903#endif
@@ -925,8 +922,8 @@ static struct ctl_table kern_table[] = {
925 .maxlen = sizeof(int), 922 .maxlen = sizeof(int),
926 .mode = 0644, 923 .mode = 0644,
927 .proc_handler = proc_watchdog, 924 .proc_handler = proc_watchdog,
928 .extra1 = &zero, 925 .extra1 = SYSCTL_ZERO,
929 .extra2 = &one, 926 .extra2 = SYSCTL_ONE,
930 }, 927 },
931 { 928 {
932 .procname = "watchdog_thresh", 929 .procname = "watchdog_thresh",
@@ -934,7 +931,7 @@ static struct ctl_table kern_table[] = {
934 .maxlen = sizeof(int), 931 .maxlen = sizeof(int),
935 .mode = 0644, 932 .mode = 0644,
936 .proc_handler = proc_watchdog_thresh, 933 .proc_handler = proc_watchdog_thresh,
937 .extra1 = &zero, 934 .extra1 = SYSCTL_ZERO,
938 .extra2 = &sixty, 935 .extra2 = &sixty,
939 }, 936 },
940 { 937 {
@@ -943,8 +940,8 @@ static struct ctl_table kern_table[] = {
943 .maxlen = sizeof(int), 940 .maxlen = sizeof(int),
944 .mode = NMI_WATCHDOG_SYSCTL_PERM, 941 .mode = NMI_WATCHDOG_SYSCTL_PERM,
945 .proc_handler = proc_nmi_watchdog, 942 .proc_handler = proc_nmi_watchdog,
946 .extra1 = &zero, 943 .extra1 = SYSCTL_ZERO,
947 .extra2 = &one, 944 .extra2 = SYSCTL_ONE,
948 }, 945 },
949 { 946 {
950 .procname = "watchdog_cpumask", 947 .procname = "watchdog_cpumask",
@@ -960,8 +957,8 @@ static struct ctl_table kern_table[] = {
960 .maxlen = sizeof(int), 957 .maxlen = sizeof(int),
961 .mode = 0644, 958 .mode = 0644,
962 .proc_handler = proc_soft_watchdog, 959 .proc_handler = proc_soft_watchdog,
963 .extra1 = &zero, 960 .extra1 = SYSCTL_ZERO,
964 .extra2 = &one, 961 .extra2 = SYSCTL_ONE,
965 }, 962 },
966 { 963 {
967 .procname = "softlockup_panic", 964 .procname = "softlockup_panic",
@@ -969,8 +966,8 @@ static struct ctl_table kern_table[] = {
969 .maxlen = sizeof(int), 966 .maxlen = sizeof(int),
970 .mode = 0644, 967 .mode = 0644,
971 .proc_handler = proc_dointvec_minmax, 968 .proc_handler = proc_dointvec_minmax,
972 .extra1 = &zero, 969 .extra1 = SYSCTL_ZERO,
973 .extra2 = &one, 970 .extra2 = SYSCTL_ONE,
974 }, 971 },
975#ifdef CONFIG_SMP 972#ifdef CONFIG_SMP
976 { 973 {
@@ -979,8 +976,8 @@ static struct ctl_table kern_table[] = {
979 .maxlen = sizeof(int), 976 .maxlen = sizeof(int),
980 .mode = 0644, 977 .mode = 0644,
981 .proc_handler = proc_dointvec_minmax, 978 .proc_handler = proc_dointvec_minmax,
982 .extra1 = &zero, 979 .extra1 = SYSCTL_ZERO,
983 .extra2 = &one, 980 .extra2 = SYSCTL_ONE,
984 }, 981 },
985#endif /* CONFIG_SMP */ 982#endif /* CONFIG_SMP */
986#endif 983#endif
@@ -991,8 +988,8 @@ static struct ctl_table kern_table[] = {
991 .maxlen = sizeof(int), 988 .maxlen = sizeof(int),
992 .mode = 0644, 989 .mode = 0644,
993 .proc_handler = proc_dointvec_minmax, 990 .proc_handler = proc_dointvec_minmax,
994 .extra1 = &zero, 991 .extra1 = SYSCTL_ZERO,
995 .extra2 = &one, 992 .extra2 = SYSCTL_ONE,
996 }, 993 },
997#ifdef CONFIG_SMP 994#ifdef CONFIG_SMP
998 { 995 {
@@ -1001,8 +998,8 @@ static struct ctl_table kern_table[] = {
1001 .maxlen = sizeof(int), 998 .maxlen = sizeof(int),
1002 .mode = 0644, 999 .mode = 0644,
1003 .proc_handler = proc_dointvec_minmax, 1000 .proc_handler = proc_dointvec_minmax,
1004 .extra1 = &zero, 1001 .extra1 = SYSCTL_ZERO,
1005 .extra2 = &one, 1002 .extra2 = SYSCTL_ONE,
1006 }, 1003 },
1007#endif /* CONFIG_SMP */ 1004#endif /* CONFIG_SMP */
1008#endif 1005#endif
@@ -1115,8 +1112,8 @@ static struct ctl_table kern_table[] = {
1115 .maxlen = sizeof(int), 1112 .maxlen = sizeof(int),
1116 .mode = 0644, 1113 .mode = 0644,
1117 .proc_handler = proc_dointvec_minmax, 1114 .proc_handler = proc_dointvec_minmax,
1118 .extra1 = &zero, 1115 .extra1 = SYSCTL_ZERO,
1119 .extra2 = &one, 1116 .extra2 = SYSCTL_ONE,
1120 }, 1117 },
1121 { 1118 {
1122 .procname = "hung_task_check_count", 1119 .procname = "hung_task_check_count",
@@ -1124,7 +1121,7 @@ static struct ctl_table kern_table[] = {
1124 .maxlen = sizeof(int), 1121 .maxlen = sizeof(int),
1125 .mode = 0644, 1122 .mode = 0644,
1126 .proc_handler = proc_dointvec_minmax, 1123 .proc_handler = proc_dointvec_minmax,
1127 .extra1 = &zero, 1124 .extra1 = SYSCTL_ZERO,
1128 }, 1125 },
1129 { 1126 {
1130 .procname = "hung_task_timeout_secs", 1127 .procname = "hung_task_timeout_secs",
@@ -1201,7 +1198,7 @@ static struct ctl_table kern_table[] = {
1201 .maxlen = sizeof(sysctl_perf_event_sample_rate), 1198 .maxlen = sizeof(sysctl_perf_event_sample_rate),
1202 .mode = 0644, 1199 .mode = 0644,
1203 .proc_handler = perf_proc_update_handler, 1200 .proc_handler = perf_proc_update_handler,
1204 .extra1 = &one, 1201 .extra1 = SYSCTL_ONE,
1205 }, 1202 },
1206 { 1203 {
1207 .procname = "perf_cpu_time_max_percent", 1204 .procname = "perf_cpu_time_max_percent",
@@ -1209,7 +1206,7 @@ static struct ctl_table kern_table[] = {
1209 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent), 1206 .maxlen = sizeof(sysctl_perf_cpu_time_max_percent),
1210 .mode = 0644, 1207 .mode = 0644,
1211 .proc_handler = perf_cpu_time_max_percent_handler, 1208 .proc_handler = perf_cpu_time_max_percent_handler,
1212 .extra1 = &zero, 1209 .extra1 = SYSCTL_ZERO,
1213 .extra2 = &one_hundred, 1210 .extra2 = &one_hundred,
1214 }, 1211 },
1215 { 1212 {
@@ -1218,7 +1215,7 @@ static struct ctl_table kern_table[] = {
1218 .maxlen = sizeof(sysctl_perf_event_max_stack), 1215 .maxlen = sizeof(sysctl_perf_event_max_stack),
1219 .mode = 0644, 1216 .mode = 0644,
1220 .proc_handler = perf_event_max_stack_handler, 1217 .proc_handler = perf_event_max_stack_handler,
1221 .extra1 = &zero, 1218 .extra1 = SYSCTL_ZERO,
1222 .extra2 = &six_hundred_forty_kb, 1219 .extra2 = &six_hundred_forty_kb,
1223 }, 1220 },
1224 { 1221 {
@@ -1227,7 +1224,7 @@ static struct ctl_table kern_table[] = {
1227 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack), 1224 .maxlen = sizeof(sysctl_perf_event_max_contexts_per_stack),
1228 .mode = 0644, 1225 .mode = 0644,
1229 .proc_handler = perf_event_max_stack_handler, 1226 .proc_handler = perf_event_max_stack_handler,
1230 .extra1 = &zero, 1227 .extra1 = SYSCTL_ZERO,
1231 .extra2 = &one_thousand, 1228 .extra2 = &one_thousand,
1232 }, 1229 },
1233#endif 1230#endif
@@ -1237,8 +1234,8 @@ static struct ctl_table kern_table[] = {
1237 .maxlen = sizeof(int), 1234 .maxlen = sizeof(int),
1238 .mode = 0644, 1235 .mode = 0644,
1239 .proc_handler = proc_dointvec_minmax, 1236 .proc_handler = proc_dointvec_minmax,
1240 .extra1 = &zero, 1237 .extra1 = SYSCTL_ZERO,
1241 .extra2 = &one, 1238 .extra2 = SYSCTL_ONE,
1242 }, 1239 },
1243#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) 1240#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1244 { 1241 {
@@ -1247,8 +1244,8 @@ static struct ctl_table kern_table[] = {
1247 .maxlen = sizeof(unsigned int), 1244 .maxlen = sizeof(unsigned int),
1248 .mode = 0644, 1245 .mode = 0644,
1249 .proc_handler = timer_migration_handler, 1246 .proc_handler = timer_migration_handler,
1250 .extra1 = &zero, 1247 .extra1 = SYSCTL_ZERO,
1251 .extra2 = &one, 1248 .extra2 = SYSCTL_ONE,
1252 }, 1249 },
1253#endif 1250#endif
1254#ifdef CONFIG_BPF_SYSCALL 1251#ifdef CONFIG_BPF_SYSCALL
@@ -1259,8 +1256,8 @@ static struct ctl_table kern_table[] = {
1259 .mode = 0644, 1256 .mode = 0644,
1260 /* only handle a transition from default "0" to "1" */ 1257 /* only handle a transition from default "0" to "1" */
1261 .proc_handler = proc_dointvec_minmax, 1258 .proc_handler = proc_dointvec_minmax,
1262 .extra1 = &one, 1259 .extra1 = SYSCTL_ONE,
1263 .extra2 = &one, 1260 .extra2 = SYSCTL_ONE,
1264 }, 1261 },
1265 { 1262 {
1266 .procname = "bpf_stats_enabled", 1263 .procname = "bpf_stats_enabled",
@@ -1277,8 +1274,8 @@ static struct ctl_table kern_table[] = {
1277 .maxlen = sizeof(sysctl_panic_on_rcu_stall), 1274 .maxlen = sizeof(sysctl_panic_on_rcu_stall),
1278 .mode = 0644, 1275 .mode = 0644,
1279 .proc_handler = proc_dointvec_minmax, 1276 .proc_handler = proc_dointvec_minmax,
1280 .extra1 = &zero, 1277 .extra1 = SYSCTL_ZERO,
1281 .extra2 = &one, 1278 .extra2 = SYSCTL_ONE,
1282 }, 1279 },
1283#endif 1280#endif
1284#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE 1281#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
@@ -1288,8 +1285,8 @@ static struct ctl_table kern_table[] = {
1288 .maxlen = sizeof(int), 1285 .maxlen = sizeof(int),
1289 .mode = 0600, 1286 .mode = 0600,
1290 .proc_handler = stack_erasing_sysctl, 1287 .proc_handler = stack_erasing_sysctl,
1291 .extra1 = &zero, 1288 .extra1 = SYSCTL_ZERO,
1292 .extra2 = &one, 1289 .extra2 = SYSCTL_ONE,
1293 }, 1290 },
1294#endif 1291#endif
1295 { } 1292 { }
@@ -1302,7 +1299,7 @@ static struct ctl_table vm_table[] = {
1302 .maxlen = sizeof(sysctl_overcommit_memory), 1299 .maxlen = sizeof(sysctl_overcommit_memory),
1303 .mode = 0644, 1300 .mode = 0644,
1304 .proc_handler = proc_dointvec_minmax, 1301 .proc_handler = proc_dointvec_minmax,
1305 .extra1 = &zero, 1302 .extra1 = SYSCTL_ZERO,
1306 .extra2 = &two, 1303 .extra2 = &two,
1307 }, 1304 },
1308 { 1305 {
@@ -1311,7 +1308,7 @@ static struct ctl_table vm_table[] = {
1311 .maxlen = sizeof(sysctl_panic_on_oom), 1308 .maxlen = sizeof(sysctl_panic_on_oom),
1312 .mode = 0644, 1309 .mode = 0644,
1313 .proc_handler = proc_dointvec_minmax, 1310 .proc_handler = proc_dointvec_minmax,
1314 .extra1 = &zero, 1311 .extra1 = SYSCTL_ZERO,
1315 .extra2 = &two, 1312 .extra2 = &two,
1316 }, 1313 },
1317 { 1314 {
@@ -1348,7 +1345,7 @@ static struct ctl_table vm_table[] = {
1348 .maxlen = sizeof(int), 1345 .maxlen = sizeof(int),
1349 .mode = 0644, 1346 .mode = 0644,
1350 .proc_handler = proc_dointvec_minmax, 1347 .proc_handler = proc_dointvec_minmax,
1351 .extra1 = &zero, 1348 .extra1 = SYSCTL_ZERO,
1352 }, 1349 },
1353 { 1350 {
1354 .procname = "dirty_background_ratio", 1351 .procname = "dirty_background_ratio",
@@ -1356,7 +1353,7 @@ static struct ctl_table vm_table[] = {
1356 .maxlen = sizeof(dirty_background_ratio), 1353 .maxlen = sizeof(dirty_background_ratio),
1357 .mode = 0644, 1354 .mode = 0644,
1358 .proc_handler = dirty_background_ratio_handler, 1355 .proc_handler = dirty_background_ratio_handler,
1359 .extra1 = &zero, 1356 .extra1 = SYSCTL_ZERO,
1360 .extra2 = &one_hundred, 1357 .extra2 = &one_hundred,
1361 }, 1358 },
1362 { 1359 {
@@ -1373,7 +1370,7 @@ static struct ctl_table vm_table[] = {
1373 .maxlen = sizeof(vm_dirty_ratio), 1370 .maxlen = sizeof(vm_dirty_ratio),
1374 .mode = 0644, 1371 .mode = 0644,
1375 .proc_handler = dirty_ratio_handler, 1372 .proc_handler = dirty_ratio_handler,
1376 .extra1 = &zero, 1373 .extra1 = SYSCTL_ZERO,
1377 .extra2 = &one_hundred, 1374 .extra2 = &one_hundred,
1378 }, 1375 },
1379 { 1376 {
@@ -1397,7 +1394,7 @@ static struct ctl_table vm_table[] = {
1397 .maxlen = sizeof(dirty_expire_interval), 1394 .maxlen = sizeof(dirty_expire_interval),
1398 .mode = 0644, 1395 .mode = 0644,
1399 .proc_handler = proc_dointvec_minmax, 1396 .proc_handler = proc_dointvec_minmax,
1400 .extra1 = &zero, 1397 .extra1 = SYSCTL_ZERO,
1401 }, 1398 },
1402 { 1399 {
1403 .procname = "dirtytime_expire_seconds", 1400 .procname = "dirtytime_expire_seconds",
@@ -1405,7 +1402,7 @@ static struct ctl_table vm_table[] = {
1405 .maxlen = sizeof(dirtytime_expire_interval), 1402 .maxlen = sizeof(dirtytime_expire_interval),
1406 .mode = 0644, 1403 .mode = 0644,
1407 .proc_handler = dirtytime_interval_handler, 1404 .proc_handler = dirtytime_interval_handler,
1408 .extra1 = &zero, 1405 .extra1 = SYSCTL_ZERO,
1409 }, 1406 },
1410 { 1407 {
1411 .procname = "swappiness", 1408 .procname = "swappiness",
@@ -1413,7 +1410,7 @@ static struct ctl_table vm_table[] = {
1413 .maxlen = sizeof(vm_swappiness), 1410 .maxlen = sizeof(vm_swappiness),
1414 .mode = 0644, 1411 .mode = 0644,
1415 .proc_handler = proc_dointvec_minmax, 1412 .proc_handler = proc_dointvec_minmax,
1416 .extra1 = &zero, 1413 .extra1 = SYSCTL_ZERO,
1417 .extra2 = &one_hundred, 1414 .extra2 = &one_hundred,
1418 }, 1415 },
1419#ifdef CONFIG_HUGETLB_PAGE 1416#ifdef CONFIG_HUGETLB_PAGE
@@ -1438,8 +1435,8 @@ static struct ctl_table vm_table[] = {
1438 .maxlen = sizeof(int), 1435 .maxlen = sizeof(int),
1439 .mode = 0644, 1436 .mode = 0644,
1440 .proc_handler = sysctl_vm_numa_stat_handler, 1437 .proc_handler = sysctl_vm_numa_stat_handler,
1441 .extra1 = &zero, 1438 .extra1 = SYSCTL_ZERO,
1442 .extra2 = &one, 1439 .extra2 = SYSCTL_ONE,
1443 }, 1440 },
1444#endif 1441#endif
1445 { 1442 {
@@ -1470,7 +1467,7 @@ static struct ctl_table vm_table[] = {
1470 .maxlen = sizeof(int), 1467 .maxlen = sizeof(int),
1471 .mode = 0644, 1468 .mode = 0644,
1472 .proc_handler = drop_caches_sysctl_handler, 1469 .proc_handler = drop_caches_sysctl_handler,
1473 .extra1 = &one, 1470 .extra1 = SYSCTL_ONE,
1474 .extra2 = &four, 1471 .extra2 = &four,
1475 }, 1472 },
1476#ifdef CONFIG_COMPACTION 1473#ifdef CONFIG_COMPACTION
@@ -1496,8 +1493,8 @@ static struct ctl_table vm_table[] = {
1496 .maxlen = sizeof(int), 1493 .maxlen = sizeof(int),
1497 .mode = 0644, 1494 .mode = 0644,
1498 .proc_handler = proc_dointvec, 1495 .proc_handler = proc_dointvec,
1499 .extra1 = &zero, 1496 .extra1 = SYSCTL_ZERO,
1500 .extra2 = &one, 1497 .extra2 = SYSCTL_ONE,
1501 }, 1498 },
1502 1499
1503#endif /* CONFIG_COMPACTION */ 1500#endif /* CONFIG_COMPACTION */
@@ -1507,7 +1504,7 @@ static struct ctl_table vm_table[] = {
1507 .maxlen = sizeof(min_free_kbytes), 1504 .maxlen = sizeof(min_free_kbytes),
1508 .mode = 0644, 1505 .mode = 0644,
1509 .proc_handler = min_free_kbytes_sysctl_handler, 1506 .proc_handler = min_free_kbytes_sysctl_handler,
1510 .extra1 = &zero, 1507 .extra1 = SYSCTL_ZERO,
1511 }, 1508 },
1512 { 1509 {
1513 .procname = "watermark_boost_factor", 1510 .procname = "watermark_boost_factor",
@@ -1515,7 +1512,7 @@ static struct ctl_table vm_table[] = {
1515 .maxlen = sizeof(watermark_boost_factor), 1512 .maxlen = sizeof(watermark_boost_factor),
1516 .mode = 0644, 1513 .mode = 0644,
1517 .proc_handler = watermark_boost_factor_sysctl_handler, 1514 .proc_handler = watermark_boost_factor_sysctl_handler,
1518 .extra1 = &zero, 1515 .extra1 = SYSCTL_ZERO,
1519 }, 1516 },
1520 { 1517 {
1521 .procname = "watermark_scale_factor", 1518 .procname = "watermark_scale_factor",
@@ -1523,7 +1520,7 @@ static struct ctl_table vm_table[] = {
1523 .maxlen = sizeof(watermark_scale_factor), 1520 .maxlen = sizeof(watermark_scale_factor),
1524 .mode = 0644, 1521 .mode = 0644,
1525 .proc_handler = watermark_scale_factor_sysctl_handler, 1522 .proc_handler = watermark_scale_factor_sysctl_handler,
1526 .extra1 = &one, 1523 .extra1 = SYSCTL_ONE,
1527 .extra2 = &one_thousand, 1524 .extra2 = &one_thousand,
1528 }, 1525 },
1529 { 1526 {
@@ -1532,7 +1529,7 @@ static struct ctl_table vm_table[] = {
1532 .maxlen = sizeof(percpu_pagelist_fraction), 1529 .maxlen = sizeof(percpu_pagelist_fraction),
1533 .mode = 0644, 1530 .mode = 0644,
1534 .proc_handler = percpu_pagelist_fraction_sysctl_handler, 1531 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1535 .extra1 = &zero, 1532 .extra1 = SYSCTL_ZERO,
1536 }, 1533 },
1537#ifdef CONFIG_MMU 1534#ifdef CONFIG_MMU
1538 { 1535 {
@@ -1541,7 +1538,7 @@ static struct ctl_table vm_table[] = {
1541 .maxlen = sizeof(sysctl_max_map_count), 1538 .maxlen = sizeof(sysctl_max_map_count),
1542 .mode = 0644, 1539 .mode = 0644,
1543 .proc_handler = proc_dointvec_minmax, 1540 .proc_handler = proc_dointvec_minmax,
1544 .extra1 = &zero, 1541 .extra1 = SYSCTL_ZERO,
1545 }, 1542 },
1546#else 1543#else
1547 { 1544 {
@@ -1550,7 +1547,7 @@ static struct ctl_table vm_table[] = {
1550 .maxlen = sizeof(sysctl_nr_trim_pages), 1547 .maxlen = sizeof(sysctl_nr_trim_pages),
1551 .mode = 0644, 1548 .mode = 0644,
1552 .proc_handler = proc_dointvec_minmax, 1549 .proc_handler = proc_dointvec_minmax,
1553 .extra1 = &zero, 1550 .extra1 = SYSCTL_ZERO,
1554 }, 1551 },
1555#endif 1552#endif
1556 { 1553 {
@@ -1566,7 +1563,7 @@ static struct ctl_table vm_table[] = {
1566 .maxlen = sizeof(block_dump), 1563 .maxlen = sizeof(block_dump),
1567 .mode = 0644, 1564 .mode = 0644,
1568 .proc_handler = proc_dointvec, 1565 .proc_handler = proc_dointvec,
1569 .extra1 = &zero, 1566 .extra1 = SYSCTL_ZERO,
1570 }, 1567 },
1571 { 1568 {
1572 .procname = "vfs_cache_pressure", 1569 .procname = "vfs_cache_pressure",
@@ -1574,7 +1571,7 @@ static struct ctl_table vm_table[] = {
1574 .maxlen = sizeof(sysctl_vfs_cache_pressure), 1571 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1575 .mode = 0644, 1572 .mode = 0644,
1576 .proc_handler = proc_dointvec, 1573 .proc_handler = proc_dointvec,
1577 .extra1 = &zero, 1574 .extra1 = SYSCTL_ZERO,
1578 }, 1575 },
1579#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 1576#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1580 { 1577 {
@@ -1583,7 +1580,7 @@ static struct ctl_table vm_table[] = {
1583 .maxlen = sizeof(sysctl_legacy_va_layout), 1580 .maxlen = sizeof(sysctl_legacy_va_layout),
1584 .mode = 0644, 1581 .mode = 0644,
1585 .proc_handler = proc_dointvec, 1582 .proc_handler = proc_dointvec,
1586 .extra1 = &zero, 1583 .extra1 = SYSCTL_ZERO,
1587 }, 1584 },
1588#endif 1585#endif
1589#ifdef CONFIG_NUMA 1586#ifdef CONFIG_NUMA
@@ -1593,7 +1590,7 @@ static struct ctl_table vm_table[] = {
1593 .maxlen = sizeof(node_reclaim_mode), 1590 .maxlen = sizeof(node_reclaim_mode),
1594 .mode = 0644, 1591 .mode = 0644,
1595 .proc_handler = proc_dointvec, 1592 .proc_handler = proc_dointvec,
1596 .extra1 = &zero, 1593 .extra1 = SYSCTL_ZERO,
1597 }, 1594 },
1598 { 1595 {
1599 .procname = "min_unmapped_ratio", 1596 .procname = "min_unmapped_ratio",
@@ -1601,7 +1598,7 @@ static struct ctl_table vm_table[] = {
1601 .maxlen = sizeof(sysctl_min_unmapped_ratio), 1598 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1602 .mode = 0644, 1599 .mode = 0644,
1603 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, 1600 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1604 .extra1 = &zero, 1601 .extra1 = SYSCTL_ZERO,
1605 .extra2 = &one_hundred, 1602 .extra2 = &one_hundred,
1606 }, 1603 },
1607 { 1604 {
@@ -1610,7 +1607,7 @@ static struct ctl_table vm_table[] = {
1610 .maxlen = sizeof(sysctl_min_slab_ratio), 1607 .maxlen = sizeof(sysctl_min_slab_ratio),
1611 .mode = 0644, 1608 .mode = 0644,
1612 .proc_handler = sysctl_min_slab_ratio_sysctl_handler, 1609 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1613 .extra1 = &zero, 1610 .extra1 = SYSCTL_ZERO,
1614 .extra2 = &one_hundred, 1611 .extra2 = &one_hundred,
1615 }, 1612 },
1616#endif 1613#endif
@@ -1661,7 +1658,7 @@ static struct ctl_table vm_table[] = {
1661#endif 1658#endif
1662 .mode = 0644, 1659 .mode = 0644,
1663 .proc_handler = proc_dointvec, 1660 .proc_handler = proc_dointvec,
1664 .extra1 = &zero, 1661 .extra1 = SYSCTL_ZERO,
1665 }, 1662 },
1666#endif 1663#endif
1667#ifdef CONFIG_HIGHMEM 1664#ifdef CONFIG_HIGHMEM
@@ -1671,8 +1668,8 @@ static struct ctl_table vm_table[] = {
1671 .maxlen = sizeof(vm_highmem_is_dirtyable), 1668 .maxlen = sizeof(vm_highmem_is_dirtyable),
1672 .mode = 0644, 1669 .mode = 0644,
1673 .proc_handler = proc_dointvec_minmax, 1670 .proc_handler = proc_dointvec_minmax,
1674 .extra1 = &zero, 1671 .extra1 = SYSCTL_ZERO,
1675 .extra2 = &one, 1672 .extra2 = SYSCTL_ONE,
1676 }, 1673 },
1677#endif 1674#endif
1678#ifdef CONFIG_MEMORY_FAILURE 1675#ifdef CONFIG_MEMORY_FAILURE
@@ -1682,8 +1679,8 @@ static struct ctl_table vm_table[] = {
1682 .maxlen = sizeof(sysctl_memory_failure_early_kill), 1679 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1683 .mode = 0644, 1680 .mode = 0644,
1684 .proc_handler = proc_dointvec_minmax, 1681 .proc_handler = proc_dointvec_minmax,
1685 .extra1 = &zero, 1682 .extra1 = SYSCTL_ZERO,
1686 .extra2 = &one, 1683 .extra2 = SYSCTL_ONE,
1687 }, 1684 },
1688 { 1685 {
1689 .procname = "memory_failure_recovery", 1686 .procname = "memory_failure_recovery",
@@ -1691,8 +1688,8 @@ static struct ctl_table vm_table[] = {
1691 .maxlen = sizeof(sysctl_memory_failure_recovery), 1688 .maxlen = sizeof(sysctl_memory_failure_recovery),
1692 .mode = 0644, 1689 .mode = 0644,
1693 .proc_handler = proc_dointvec_minmax, 1690 .proc_handler = proc_dointvec_minmax,
1694 .extra1 = &zero, 1691 .extra1 = SYSCTL_ZERO,
1695 .extra2 = &one, 1692 .extra2 = SYSCTL_ONE,
1696 }, 1693 },
1697#endif 1694#endif
1698 { 1695 {
@@ -1738,8 +1735,8 @@ static struct ctl_table vm_table[] = {
1738 .maxlen = sizeof(sysctl_unprivileged_userfaultfd), 1735 .maxlen = sizeof(sysctl_unprivileged_userfaultfd),
1739 .mode = 0644, 1736 .mode = 0644,
1740 .proc_handler = proc_dointvec_minmax, 1737 .proc_handler = proc_dointvec_minmax,
1741 .extra1 = &zero, 1738 .extra1 = SYSCTL_ZERO,
1742 .extra2 = &one, 1739 .extra2 = SYSCTL_ONE,
1743 }, 1740 },
1744#endif 1741#endif
1745 { } 1742 { }
@@ -1875,8 +1872,8 @@ static struct ctl_table fs_table[] = {
1875 .maxlen = sizeof(int), 1872 .maxlen = sizeof(int),
1876 .mode = 0600, 1873 .mode = 0600,
1877 .proc_handler = proc_dointvec_minmax, 1874 .proc_handler = proc_dointvec_minmax,
1878 .extra1 = &zero, 1875 .extra1 = SYSCTL_ZERO,
1879 .extra2 = &one, 1876 .extra2 = SYSCTL_ONE,
1880 }, 1877 },
1881 { 1878 {
1882 .procname = "protected_hardlinks", 1879 .procname = "protected_hardlinks",
@@ -1884,8 +1881,8 @@ static struct ctl_table fs_table[] = {
1884 .maxlen = sizeof(int), 1881 .maxlen = sizeof(int),
1885 .mode = 0600, 1882 .mode = 0600,
1886 .proc_handler = proc_dointvec_minmax, 1883 .proc_handler = proc_dointvec_minmax,
1887 .extra1 = &zero, 1884 .extra1 = SYSCTL_ZERO,
1888 .extra2 = &one, 1885 .extra2 = SYSCTL_ONE,
1889 }, 1886 },
1890 { 1887 {
1891 .procname = "protected_fifos", 1888 .procname = "protected_fifos",
@@ -1893,7 +1890,7 @@ static struct ctl_table fs_table[] = {
1893 .maxlen = sizeof(int), 1890 .maxlen = sizeof(int),
1894 .mode = 0600, 1891 .mode = 0600,
1895 .proc_handler = proc_dointvec_minmax, 1892 .proc_handler = proc_dointvec_minmax,
1896 .extra1 = &zero, 1893 .extra1 = SYSCTL_ZERO,
1897 .extra2 = &two, 1894 .extra2 = &two,
1898 }, 1895 },
1899 { 1896 {
@@ -1902,7 +1899,7 @@ static struct ctl_table fs_table[] = {
1902 .maxlen = sizeof(int), 1899 .maxlen = sizeof(int),
1903 .mode = 0600, 1900 .mode = 0600,
1904 .proc_handler = proc_dointvec_minmax, 1901 .proc_handler = proc_dointvec_minmax,
1905 .extra1 = &zero, 1902 .extra1 = SYSCTL_ZERO,
1906 .extra2 = &two, 1903 .extra2 = &two,
1907 }, 1904 },
1908 { 1905 {
@@ -1911,7 +1908,7 @@ static struct ctl_table fs_table[] = {
1911 .maxlen = sizeof(int), 1908 .maxlen = sizeof(int),
1912 .mode = 0644, 1909 .mode = 0644,
1913 .proc_handler = proc_dointvec_minmax_coredump, 1910 .proc_handler = proc_dointvec_minmax_coredump,
1914 .extra1 = &zero, 1911 .extra1 = SYSCTL_ZERO,
1915 .extra2 = &two, 1912 .extra2 = &two,
1916 }, 1913 },
1917#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1914#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
@@ -1948,7 +1945,7 @@ static struct ctl_table fs_table[] = {
1948 .maxlen = sizeof(unsigned int), 1945 .maxlen = sizeof(unsigned int),
1949 .mode = 0644, 1946 .mode = 0644,
1950 .proc_handler = proc_dointvec_minmax, 1947 .proc_handler = proc_dointvec_minmax,
1951 .extra1 = &one, 1948 .extra1 = SYSCTL_ONE,
1952 }, 1949 },
1953 { } 1950 { }
1954}; 1951};
@@ -1970,8 +1967,8 @@ static struct ctl_table debug_table[] = {
1970 .maxlen = sizeof(int), 1967 .maxlen = sizeof(int),
1971 .mode = 0644, 1968 .mode = 0644,
1972 .proc_handler = proc_kprobes_optimization_handler, 1969 .proc_handler = proc_kprobes_optimization_handler,
1973 .extra1 = &zero, 1970 .extra1 = SYSCTL_ZERO,
1974 .extra2 = &one, 1971 .extra2 = SYSCTL_ONE,
1975 }, 1972 },
1976#endif 1973#endif
1977 { } 1974 { }
@@ -3395,8 +3392,8 @@ int proc_do_static_key(struct ctl_table *table, int write,
3395 .data = &val, 3392 .data = &val,
3396 .maxlen = sizeof(val), 3393 .maxlen = sizeof(val),
3397 .mode = table->mode, 3394 .mode = table->mode,
3398 .extra1 = &zero, 3395 .extra1 = SYSCTL_ZERO,
3399 .extra2 = &one, 3396 .extra2 = SYSCTL_ONE,
3400 }; 3397 };
3401 3398
3402 if (write && !capable(CAP_SYS_ADMIN)) 3399 if (write && !capable(CAP_SYS_ADMIN))
diff --git a/kernel/ucount.c b/kernel/ucount.c
index feb128c7b5d9..a53cc2b4179c 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -52,16 +52,14 @@ static struct ctl_table_root set_root = {
52 .permissions = set_permissions, 52 .permissions = set_permissions,
53}; 53};
54 54
55static int zero = 0;
56static int int_max = INT_MAX;
57#define UCOUNT_ENTRY(name) \ 55#define UCOUNT_ENTRY(name) \
58 { \ 56 { \
59 .procname = name, \ 57 .procname = name, \
60 .maxlen = sizeof(int), \ 58 .maxlen = sizeof(int), \
61 .mode = 0644, \ 59 .mode = 0644, \
62 .proc_handler = proc_dointvec_minmax, \ 60 .proc_handler = proc_dointvec_minmax, \
63 .extra1 = &zero, \ 61 .extra1 = SYSCTL_ZERO, \
64 .extra2 = &int_max, \ 62 .extra2 = SYSCTL_INT_MAX, \
65 } 63 }
66static struct ctl_table user_table[] = { 64static struct ctl_table user_table[] = {
67 UCOUNT_ENTRY("max_user_namespaces"), 65 UCOUNT_ENTRY("max_user_namespaces"),
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 742cea4ce72e..26da97359d5b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3374,8 +3374,6 @@ void neigh_app_ns(struct neighbour *n)
3374EXPORT_SYMBOL(neigh_app_ns); 3374EXPORT_SYMBOL(neigh_app_ns);
3375 3375
3376#ifdef CONFIG_SYSCTL 3376#ifdef CONFIG_SYSCTL
3377static int zero;
3378static int int_max = INT_MAX;
3379static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); 3377static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
3380 3378
3381static int proc_unres_qlen(struct ctl_table *ctl, int write, 3379static int proc_unres_qlen(struct ctl_table *ctl, int write,
@@ -3384,7 +3382,7 @@ static int proc_unres_qlen(struct ctl_table *ctl, int write,
3384 int size, ret; 3382 int size, ret;
3385 struct ctl_table tmp = *ctl; 3383 struct ctl_table tmp = *ctl;
3386 3384
3387 tmp.extra1 = &zero; 3385 tmp.extra1 = SYSCTL_ZERO;
3388 tmp.extra2 = &unres_qlen_max; 3386 tmp.extra2 = &unres_qlen_max;
3389 tmp.data = &size; 3387 tmp.data = &size;
3390 3388
@@ -3449,8 +3447,8 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,
3449 struct ctl_table tmp = *ctl; 3447 struct ctl_table tmp = *ctl;
3450 int ret; 3448 int ret;
3451 3449
3452 tmp.extra1 = &zero; 3450 tmp.extra1 = SYSCTL_ZERO;
3453 tmp.extra2 = &int_max; 3451 tmp.extra2 = SYSCTL_INT_MAX;
3454 3452
3455 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); 3453 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
3456 neigh_proc_update(ctl, write); 3454 neigh_proc_update(ctl, write);
@@ -3595,24 +3593,24 @@ static struct neigh_sysctl_table {
3595 .procname = "gc_thresh1", 3593 .procname = "gc_thresh1",
3596 .maxlen = sizeof(int), 3594 .maxlen = sizeof(int),
3597 .mode = 0644, 3595 .mode = 0644,
3598 .extra1 = &zero, 3596 .extra1 = SYSCTL_ZERO,
3599 .extra2 = &int_max, 3597 .extra2 = SYSCTL_INT_MAX,
3600 .proc_handler = proc_dointvec_minmax, 3598 .proc_handler = proc_dointvec_minmax,
3601 }, 3599 },
3602 [NEIGH_VAR_GC_THRESH2] = { 3600 [NEIGH_VAR_GC_THRESH2] = {
3603 .procname = "gc_thresh2", 3601 .procname = "gc_thresh2",
3604 .maxlen = sizeof(int), 3602 .maxlen = sizeof(int),
3605 .mode = 0644, 3603 .mode = 0644,
3606 .extra1 = &zero, 3604 .extra1 = SYSCTL_ZERO,
3607 .extra2 = &int_max, 3605 .extra2 = SYSCTL_INT_MAX,
3608 .proc_handler = proc_dointvec_minmax, 3606 .proc_handler = proc_dointvec_minmax,
3609 }, 3607 },
3610 [NEIGH_VAR_GC_THRESH3] = { 3608 [NEIGH_VAR_GC_THRESH3] = {
3611 .procname = "gc_thresh3", 3609 .procname = "gc_thresh3",
3612 .maxlen = sizeof(int), 3610 .maxlen = sizeof(int),
3613 .mode = 0644, 3611 .mode = 0644,
3614 .extra1 = &zero, 3612 .extra1 = SYSCTL_ZERO,
3615 .extra2 = &int_max, 3613 .extra2 = SYSCTL_INT_MAX,
3616 .proc_handler = proc_dointvec_minmax, 3614 .proc_handler = proc_dointvec_minmax,
3617 }, 3615 },
3618 {}, 3616 {},
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index f9204719aeee..8da5b3a54dac 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -22,8 +22,6 @@
22#include <net/busy_poll.h> 22#include <net/busy_poll.h>
23#include <net/pkt_sched.h> 23#include <net/pkt_sched.h>
24 24
25static int zero = 0;
26static int one = 1;
27static int two __maybe_unused = 2; 25static int two __maybe_unused = 2;
28static int min_sndbuf = SOCK_MIN_SNDBUF; 26static int min_sndbuf = SOCK_MIN_SNDBUF;
29static int min_rcvbuf = SOCK_MIN_RCVBUF; 27static int min_rcvbuf = SOCK_MIN_RCVBUF;
@@ -390,10 +388,10 @@ static struct ctl_table net_core_table[] = {
390 .mode = 0644, 388 .mode = 0644,
391 .proc_handler = proc_dointvec_minmax_bpf_enable, 389 .proc_handler = proc_dointvec_minmax_bpf_enable,
392# ifdef CONFIG_BPF_JIT_ALWAYS_ON 390# ifdef CONFIG_BPF_JIT_ALWAYS_ON
393 .extra1 = &one, 391 .extra1 = SYSCTL_ONE,
394 .extra2 = &one, 392 .extra2 = SYSCTL_ONE,
395# else 393# else
396 .extra1 = &zero, 394 .extra1 = SYSCTL_ZERO,
397 .extra2 = &two, 395 .extra2 = &two,
398# endif 396# endif
399 }, 397 },
@@ -404,7 +402,7 @@ static struct ctl_table net_core_table[] = {
404 .maxlen = sizeof(int), 402 .maxlen = sizeof(int),
405 .mode = 0600, 403 .mode = 0600,
406 .proc_handler = proc_dointvec_minmax_bpf_restricted, 404 .proc_handler = proc_dointvec_minmax_bpf_restricted,
407 .extra1 = &zero, 405 .extra1 = SYSCTL_ZERO,
408 .extra2 = &two, 406 .extra2 = &two,
409 }, 407 },
410 { 408 {
@@ -413,8 +411,8 @@ static struct ctl_table net_core_table[] = {
413 .maxlen = sizeof(int), 411 .maxlen = sizeof(int),
414 .mode = 0600, 412 .mode = 0600,
415 .proc_handler = proc_dointvec_minmax_bpf_restricted, 413 .proc_handler = proc_dointvec_minmax_bpf_restricted,
416 .extra1 = &zero, 414 .extra1 = SYSCTL_ZERO,
417 .extra2 = &one, 415 .extra2 = SYSCTL_ONE,
418 }, 416 },
419# endif 417# endif
420 { 418 {
@@ -461,8 +459,8 @@ static struct ctl_table net_core_table[] = {
461 .maxlen = sizeof(int), 459 .maxlen = sizeof(int),
462 .mode = 0644, 460 .mode = 0644,
463 .proc_handler = proc_dointvec_minmax, 461 .proc_handler = proc_dointvec_minmax,
464 .extra1 = &zero, 462 .extra1 = SYSCTL_ZERO,
465 .extra2 = &one 463 .extra2 = SYSCTL_ONE
466 }, 464 },
467#ifdef CONFIG_RPS 465#ifdef CONFIG_RPS
468 { 466 {
@@ -493,7 +491,7 @@ static struct ctl_table net_core_table[] = {
493 .maxlen = sizeof(unsigned int), 491 .maxlen = sizeof(unsigned int),
494 .mode = 0644, 492 .mode = 0644,
495 .proc_handler = proc_dointvec_minmax, 493 .proc_handler = proc_dointvec_minmax,
496 .extra1 = &zero, 494 .extra1 = SYSCTL_ZERO,
497 }, 495 },
498 { 496 {
499 .procname = "busy_read", 497 .procname = "busy_read",
@@ -501,7 +499,7 @@ static struct ctl_table net_core_table[] = {
501 .maxlen = sizeof(unsigned int), 499 .maxlen = sizeof(unsigned int),
502 .mode = 0644, 500 .mode = 0644,
503 .proc_handler = proc_dointvec_minmax, 501 .proc_handler = proc_dointvec_minmax,
504 .extra1 = &zero, 502 .extra1 = SYSCTL_ZERO,
505 }, 503 },
506#endif 504#endif
507#ifdef CONFIG_NET_SCHED 505#ifdef CONFIG_NET_SCHED
@@ -533,7 +531,7 @@ static struct ctl_table net_core_table[] = {
533 .maxlen = sizeof(int), 531 .maxlen = sizeof(int),
534 .mode = 0644, 532 .mode = 0644,
535 .proc_handler = proc_dointvec_minmax, 533 .proc_handler = proc_dointvec_minmax,
536 .extra1 = &one, 534 .extra1 = SYSCTL_ONE,
537 .extra2 = &max_skb_frags, 535 .extra2 = &max_skb_frags,
538 }, 536 },
539 { 537 {
@@ -542,7 +540,7 @@ static struct ctl_table net_core_table[] = {
542 .maxlen = sizeof(unsigned int), 540 .maxlen = sizeof(unsigned int),
543 .mode = 0644, 541 .mode = 0644,
544 .proc_handler = proc_dointvec_minmax, 542 .proc_handler = proc_dointvec_minmax,
545 .extra1 = &zero, 543 .extra1 = SYSCTL_ZERO,
546 }, 544 },
547 { 545 {
548 .procname = "fb_tunnels_only_for_init_net", 546 .procname = "fb_tunnels_only_for_init_net",
@@ -550,8 +548,8 @@ static struct ctl_table net_core_table[] = {
550 .maxlen = sizeof(int), 548 .maxlen = sizeof(int),
551 .mode = 0644, 549 .mode = 0644,
552 .proc_handler = proc_dointvec_minmax, 550 .proc_handler = proc_dointvec_minmax,
553 .extra1 = &zero, 551 .extra1 = SYSCTL_ZERO,
554 .extra2 = &one, 552 .extra2 = SYSCTL_ONE,
555 }, 553 },
556 { 554 {
557 .procname = "devconf_inherit_init_net", 555 .procname = "devconf_inherit_init_net",
@@ -559,7 +557,7 @@ static struct ctl_table net_core_table[] = {
559 .maxlen = sizeof(int), 557 .maxlen = sizeof(int),
560 .mode = 0644, 558 .mode = 0644,
561 .proc_handler = proc_dointvec_minmax, 559 .proc_handler = proc_dointvec_minmax,
562 .extra1 = &zero, 560 .extra1 = SYSCTL_ZERO,
563 .extra2 = &two, 561 .extra2 = &two,
564 }, 562 },
565 { 563 {
@@ -578,7 +576,7 @@ static struct ctl_table netns_core_table[] = {
578 .data = &init_net.core.sysctl_somaxconn, 576 .data = &init_net.core.sysctl_somaxconn,
579 .maxlen = sizeof(int), 577 .maxlen = sizeof(int),
580 .mode = 0644, 578 .mode = 0644,
581 .extra1 = &zero, 579 .extra1 = SYSCTL_ZERO,
582 .proc_handler = proc_dointvec_minmax 580 .proc_handler = proc_dointvec_minmax
583 }, 581 },
584 { } 582 { }
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index b59040f268a9..ee8d4f5afa72 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -16,9 +16,7 @@
16#endif 16#endif
17 17
18/* Boundary values */ 18/* Boundary values */
19static int zero = 0, 19static int u8_max = 0xFF;
20 one = 1,
21 u8_max = 0xFF;
22static unsigned long seqw_min = DCCPF_SEQ_WMIN, 20static unsigned long seqw_min = DCCPF_SEQ_WMIN,
23 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */ 21 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
24 22
@@ -38,7 +36,7 @@ static struct ctl_table dccp_default_table[] = {
38 .maxlen = sizeof(sysctl_dccp_rx_ccid), 36 .maxlen = sizeof(sysctl_dccp_rx_ccid),
39 .mode = 0644, 37 .mode = 0644,
40 .proc_handler = proc_dointvec_minmax, 38 .proc_handler = proc_dointvec_minmax,
41 .extra1 = &zero, 39 .extra1 = SYSCTL_ZERO,
42 .extra2 = &u8_max, /* RFC 4340, 10. */ 40 .extra2 = &u8_max, /* RFC 4340, 10. */
43 }, 41 },
44 { 42 {
@@ -47,7 +45,7 @@ static struct ctl_table dccp_default_table[] = {
47 .maxlen = sizeof(sysctl_dccp_tx_ccid), 45 .maxlen = sizeof(sysctl_dccp_tx_ccid),
48 .mode = 0644, 46 .mode = 0644,
49 .proc_handler = proc_dointvec_minmax, 47 .proc_handler = proc_dointvec_minmax,
50 .extra1 = &zero, 48 .extra1 = SYSCTL_ZERO,
51 .extra2 = &u8_max, /* RFC 4340, 10. */ 49 .extra2 = &u8_max, /* RFC 4340, 10. */
52 }, 50 },
53 { 51 {
@@ -56,7 +54,7 @@ static struct ctl_table dccp_default_table[] = {
56 .maxlen = sizeof(sysctl_dccp_request_retries), 54 .maxlen = sizeof(sysctl_dccp_request_retries),
57 .mode = 0644, 55 .mode = 0644,
58 .proc_handler = proc_dointvec_minmax, 56 .proc_handler = proc_dointvec_minmax,
59 .extra1 = &one, 57 .extra1 = SYSCTL_ONE,
60 .extra2 = &u8_max, 58 .extra2 = &u8_max,
61 }, 59 },
62 { 60 {
@@ -65,7 +63,7 @@ static struct ctl_table dccp_default_table[] = {
65 .maxlen = sizeof(sysctl_dccp_retries1), 63 .maxlen = sizeof(sysctl_dccp_retries1),
66 .mode = 0644, 64 .mode = 0644,
67 .proc_handler = proc_dointvec_minmax, 65 .proc_handler = proc_dointvec_minmax,
68 .extra1 = &zero, 66 .extra1 = SYSCTL_ZERO,
69 .extra2 = &u8_max, 67 .extra2 = &u8_max,
70 }, 68 },
71 { 69 {
@@ -74,7 +72,7 @@ static struct ctl_table dccp_default_table[] = {
74 .maxlen = sizeof(sysctl_dccp_retries2), 72 .maxlen = sizeof(sysctl_dccp_retries2),
75 .mode = 0644, 73 .mode = 0644,
76 .proc_handler = proc_dointvec_minmax, 74 .proc_handler = proc_dointvec_minmax,
77 .extra1 = &zero, 75 .extra1 = SYSCTL_ZERO,
78 .extra2 = &u8_max, 76 .extra2 = &u8_max,
79 }, 77 },
80 { 78 {
@@ -83,7 +81,7 @@ static struct ctl_table dccp_default_table[] = {
83 .maxlen = sizeof(sysctl_dccp_tx_qlen), 81 .maxlen = sizeof(sysctl_dccp_tx_qlen),
84 .mode = 0644, 82 .mode = 0644,
85 .proc_handler = proc_dointvec_minmax, 83 .proc_handler = proc_dointvec_minmax,
86 .extra1 = &zero, 84 .extra1 = SYSCTL_ZERO,
87 }, 85 },
88 { 86 {
89 .procname = "sync_ratelimit", 87 .procname = "sync_ratelimit",
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 7d66306b5f39..0b980e841927 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -28,8 +28,6 @@
28#include <net/protocol.h> 28#include <net/protocol.h>
29#include <net/netevent.h> 29#include <net/netevent.h>
30 30
31static int zero;
32static int one = 1;
33static int two = 2; 31static int two = 2;
34static int four = 4; 32static int four = 4;
35static int thousand = 1000; 33static int thousand = 1000;
@@ -576,7 +574,7 @@ static struct ctl_table ipv4_table[] = {
576 .maxlen = sizeof(int), 574 .maxlen = sizeof(int),
577 .mode = 0644, 575 .mode = 0644,
578 .proc_handler = proc_dointvec_minmax, 576 .proc_handler = proc_dointvec_minmax,
579 .extra1 = &zero, 577 .extra1 = SYSCTL_ZERO,
580 }, 578 },
581 { 579 {
582 .procname = "icmp_msgs_burst", 580 .procname = "icmp_msgs_burst",
@@ -584,7 +582,7 @@ static struct ctl_table ipv4_table[] = {
584 .maxlen = sizeof(int), 582 .maxlen = sizeof(int),
585 .mode = 0644, 583 .mode = 0644,
586 .proc_handler = proc_dointvec_minmax, 584 .proc_handler = proc_dointvec_minmax,
587 .extra1 = &zero, 585 .extra1 = SYSCTL_ZERO,
588 }, 586 },
589 { 587 {
590 .procname = "udp_mem", 588 .procname = "udp_mem",
@@ -674,8 +672,8 @@ static struct ctl_table ipv4_net_table[] = {
674 .maxlen = sizeof(int), 672 .maxlen = sizeof(int),
675 .mode = 0644, 673 .mode = 0644,
676 .proc_handler = proc_dointvec_minmax, 674 .proc_handler = proc_dointvec_minmax,
677 .extra1 = &zero, 675 .extra1 = SYSCTL_ZERO,
678 .extra2 = &one, 676 .extra2 = SYSCTL_ONE,
679 }, 677 },
680#endif 678#endif
681 { 679 {
@@ -763,8 +761,8 @@ static struct ctl_table ipv4_net_table[] = {
763 .maxlen = sizeof(int), 761 .maxlen = sizeof(int),
764 .mode = 0644, 762 .mode = 0644,
765 .proc_handler = ipv4_fwd_update_priority, 763 .proc_handler = ipv4_fwd_update_priority,
766 .extra1 = &zero, 764 .extra1 = SYSCTL_ZERO,
767 .extra2 = &one, 765 .extra2 = SYSCTL_ONE,
768 }, 766 },
769 { 767 {
770 .procname = "ip_nonlocal_bind", 768 .procname = "ip_nonlocal_bind",
@@ -794,8 +792,8 @@ static struct ctl_table ipv4_net_table[] = {
794 .maxlen = sizeof(int), 792 .maxlen = sizeof(int),
795 .mode = 0644, 793 .mode = 0644,
796 .proc_handler = proc_dointvec_minmax, 794 .proc_handler = proc_dointvec_minmax,
797 .extra1 = &zero, 795 .extra1 = SYSCTL_ZERO,
798 .extra2 = &one, 796 .extra2 = SYSCTL_ONE,
799 }, 797 },
800#endif 798#endif
801 { 799 {
@@ -864,7 +862,7 @@ static struct ctl_table ipv4_net_table[] = {
864 .maxlen = sizeof(int), 862 .maxlen = sizeof(int),
865 .mode = 0644, 863 .mode = 0644,
866 .proc_handler = proc_dointvec_minmax, 864 .proc_handler = proc_dointvec_minmax,
867 .extra1 = &one 865 .extra1 = SYSCTL_ONE
868 }, 866 },
869#endif 867#endif
870 { 868 {
@@ -969,7 +967,7 @@ static struct ctl_table ipv4_net_table[] = {
969 .maxlen = sizeof(int), 967 .maxlen = sizeof(int),
970 .mode = 0644, 968 .mode = 0644,
971 .proc_handler = proc_dointvec_minmax, 969 .proc_handler = proc_dointvec_minmax,
972 .extra1 = &zero, 970 .extra1 = SYSCTL_ZERO,
973 .extra2 = &two, 971 .extra2 = &two,
974 }, 972 },
975 { 973 {
@@ -1011,7 +1009,7 @@ static struct ctl_table ipv4_net_table[] = {
1011 .maxlen = sizeof(int), 1009 .maxlen = sizeof(int),
1012 .mode = 0644, 1010 .mode = 0644,
1013 .proc_handler = proc_tfo_blackhole_detect_timeout, 1011 .proc_handler = proc_tfo_blackhole_detect_timeout,
1014 .extra1 = &zero, 1012 .extra1 = SYSCTL_ZERO,
1015 }, 1013 },
1016#ifdef CONFIG_IP_ROUTE_MULTIPATH 1014#ifdef CONFIG_IP_ROUTE_MULTIPATH
1017 { 1015 {
@@ -1020,8 +1018,8 @@ static struct ctl_table ipv4_net_table[] = {
1020 .maxlen = sizeof(int), 1018 .maxlen = sizeof(int),
1021 .mode = 0644, 1019 .mode = 0644,
1022 .proc_handler = proc_dointvec_minmax, 1020 .proc_handler = proc_dointvec_minmax,
1023 .extra1 = &zero, 1021 .extra1 = SYSCTL_ZERO,
1024 .extra2 = &one, 1022 .extra2 = SYSCTL_ONE,
1025 }, 1023 },
1026 { 1024 {
1027 .procname = "fib_multipath_hash_policy", 1025 .procname = "fib_multipath_hash_policy",
@@ -1029,8 +1027,8 @@ static struct ctl_table ipv4_net_table[] = {
1029 .maxlen = sizeof(int), 1027 .maxlen = sizeof(int),
1030 .mode = 0644, 1028 .mode = 0644,
1031 .proc_handler = proc_fib_multipath_hash_policy, 1029 .proc_handler = proc_fib_multipath_hash_policy,
1032 .extra1 = &zero, 1030 .extra1 = SYSCTL_ZERO,
1033 .extra2 = &two, 1031 .extra2 = SYSCTL_ONE,
1034 }, 1032 },
1035#endif 1033#endif
1036 { 1034 {
@@ -1047,8 +1045,8 @@ static struct ctl_table ipv4_net_table[] = {
1047 .maxlen = sizeof(int), 1045 .maxlen = sizeof(int),
1048 .mode = 0644, 1046 .mode = 0644,
1049 .proc_handler = proc_dointvec_minmax, 1047 .proc_handler = proc_dointvec_minmax,
1050 .extra1 = &zero, 1048 .extra1 = SYSCTL_ZERO,
1051 .extra2 = &one, 1049 .extra2 = SYSCTL_ONE,
1052 }, 1050 },
1053#endif 1051#endif
1054 { 1052 {
@@ -1078,7 +1076,7 @@ static struct ctl_table ipv4_net_table[] = {
1078 .maxlen = sizeof(int), 1076 .maxlen = sizeof(int),
1079 .mode = 0644, 1077 .mode = 0644,
1080 .proc_handler = proc_dointvec_minmax, 1078 .proc_handler = proc_dointvec_minmax,
1081 .extra1 = &zero, 1079 .extra1 = SYSCTL_ZERO,
1082 .extra2 = &four, 1080 .extra2 = &four,
1083 }, 1081 },
1084 { 1082 {
@@ -1222,7 +1220,7 @@ static struct ctl_table ipv4_net_table[] = {
1222 .maxlen = sizeof(int), 1220 .maxlen = sizeof(int),
1223 .mode = 0644, 1221 .mode = 0644,
1224 .proc_handler = proc_dointvec_minmax, 1222 .proc_handler = proc_dointvec_minmax,
1225 .extra1 = &one, 1223 .extra1 = SYSCTL_ONE,
1226 .extra2 = &gso_max_segs, 1224 .extra2 = &gso_max_segs,
1227 }, 1225 },
1228 { 1226 {
@@ -1231,7 +1229,7 @@ static struct ctl_table ipv4_net_table[] = {
1231 .maxlen = sizeof(int), 1229 .maxlen = sizeof(int),
1232 .mode = 0644, 1230 .mode = 0644,
1233 .proc_handler = proc_dointvec_minmax, 1231 .proc_handler = proc_dointvec_minmax,
1234 .extra1 = &zero, 1232 .extra1 = SYSCTL_ZERO,
1235 .extra2 = &one_day_secs 1233 .extra2 = &one_day_secs
1236 }, 1234 },
1237 { 1235 {
@@ -1240,8 +1238,8 @@ static struct ctl_table ipv4_net_table[] = {
1240 .maxlen = sizeof(int), 1238 .maxlen = sizeof(int),
1241 .mode = 0644, 1239 .mode = 0644,
1242 .proc_handler = proc_dointvec_minmax, 1240 .proc_handler = proc_dointvec_minmax,
1243 .extra1 = &zero, 1241 .extra1 = SYSCTL_ZERO,
1244 .extra2 = &one, 1242 .extra2 = SYSCTL_ONE,
1245 }, 1243 },
1246 { 1244 {
1247 .procname = "tcp_invalid_ratelimit", 1245 .procname = "tcp_invalid_ratelimit",
@@ -1256,7 +1254,7 @@ static struct ctl_table ipv4_net_table[] = {
1256 .maxlen = sizeof(int), 1254 .maxlen = sizeof(int),
1257 .mode = 0644, 1255 .mode = 0644,
1258 .proc_handler = proc_dointvec_minmax, 1256 .proc_handler = proc_dointvec_minmax,
1259 .extra1 = &zero, 1257 .extra1 = SYSCTL_ZERO,
1260 .extra2 = &thousand, 1258 .extra2 = &thousand,
1261 }, 1259 },
1262 { 1260 {
@@ -1265,7 +1263,7 @@ static struct ctl_table ipv4_net_table[] = {
1265 .maxlen = sizeof(int), 1263 .maxlen = sizeof(int),
1266 .mode = 0644, 1264 .mode = 0644,
1267 .proc_handler = proc_dointvec_minmax, 1265 .proc_handler = proc_dointvec_minmax,
1268 .extra1 = &zero, 1266 .extra1 = SYSCTL_ZERO,
1269 .extra2 = &thousand, 1267 .extra2 = &thousand,
1270 }, 1268 },
1271 { 1269 {
@@ -1274,7 +1272,7 @@ static struct ctl_table ipv4_net_table[] = {
1274 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_wmem), 1272 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_wmem),
1275 .mode = 0644, 1273 .mode = 0644,
1276 .proc_handler = proc_dointvec_minmax, 1274 .proc_handler = proc_dointvec_minmax,
1277 .extra1 = &one, 1275 .extra1 = SYSCTL_ONE,
1278 }, 1276 },
1279 { 1277 {
1280 .procname = "tcp_rmem", 1278 .procname = "tcp_rmem",
@@ -1282,7 +1280,7 @@ static struct ctl_table ipv4_net_table[] = {
1282 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_rmem), 1280 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_rmem),
1283 .mode = 0644, 1281 .mode = 0644,
1284 .proc_handler = proc_dointvec_minmax, 1282 .proc_handler = proc_dointvec_minmax,
1285 .extra1 = &one, 1283 .extra1 = SYSCTL_ONE,
1286 }, 1284 },
1287 { 1285 {
1288 .procname = "tcp_comp_sack_delay_ns", 1286 .procname = "tcp_comp_sack_delay_ns",
@@ -1297,7 +1295,7 @@ static struct ctl_table ipv4_net_table[] = {
1297 .maxlen = sizeof(int), 1295 .maxlen = sizeof(int),
1298 .mode = 0644, 1296 .mode = 0644,
1299 .proc_handler = proc_dointvec_minmax, 1297 .proc_handler = proc_dointvec_minmax,
1300 .extra1 = &zero, 1298 .extra1 = SYSCTL_ZERO,
1301 .extra2 = &comp_sack_nr_max, 1299 .extra2 = &comp_sack_nr_max,
1302 }, 1300 },
1303 { 1301 {
@@ -1306,7 +1304,7 @@ static struct ctl_table ipv4_net_table[] = {
1306 .maxlen = sizeof(init_net.ipv4.sysctl_udp_rmem_min), 1304 .maxlen = sizeof(init_net.ipv4.sysctl_udp_rmem_min),
1307 .mode = 0644, 1305 .mode = 0644,
1308 .proc_handler = proc_dointvec_minmax, 1306 .proc_handler = proc_dointvec_minmax,
1309 .extra1 = &one 1307 .extra1 = SYSCTL_ONE
1310 }, 1308 },
1311 { 1309 {
1312 .procname = "udp_wmem_min", 1310 .procname = "udp_wmem_min",
@@ -1314,7 +1312,7 @@ static struct ctl_table ipv4_net_table[] = {
1314 .maxlen = sizeof(init_net.ipv4.sysctl_udp_wmem_min), 1312 .maxlen = sizeof(init_net.ipv4.sysctl_udp_wmem_min),
1315 .mode = 0644, 1313 .mode = 0644,
1316 .proc_handler = proc_dointvec_minmax, 1314 .proc_handler = proc_dointvec_minmax,
1317 .extra1 = &one 1315 .extra1 = SYSCTL_ONE
1318 }, 1316 },
1319 { } 1317 { }
1320}; 1318};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 521e3203e83a..dc73888c7859 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6432,8 +6432,6 @@ int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write,
6432} 6432}
6433 6433
6434static int minus_one = -1; 6434static int minus_one = -1;
6435static const int zero = 0;
6436static const int one = 1;
6437static const int two_five_five = 255; 6435static const int two_five_five = 255;
6438 6436
6439static const struct ctl_table addrconf_sysctl[] = { 6437static const struct ctl_table addrconf_sysctl[] = {
@@ -6450,7 +6448,7 @@ static const struct ctl_table addrconf_sysctl[] = {
6450 .maxlen = sizeof(int), 6448 .maxlen = sizeof(int),
6451 .mode = 0644, 6449 .mode = 0644,
6452 .proc_handler = proc_dointvec_minmax, 6450 .proc_handler = proc_dointvec_minmax,
6453 .extra1 = (void *)&one, 6451 .extra1 = (void *)SYSCTL_ONE,
6454 .extra2 = (void *)&two_five_five, 6452 .extra2 = (void *)&two_five_five,
6455 }, 6453 },
6456 { 6454 {
@@ -6809,7 +6807,7 @@ static const struct ctl_table addrconf_sysctl[] = {
6809 .maxlen = sizeof(int), 6807 .maxlen = sizeof(int),
6810 .mode = 0644, 6808 .mode = 0644,
6811 .proc_handler = proc_dointvec_minmax, 6809 .proc_handler = proc_dointvec_minmax,
6812 .extra1 = (void *)&zero, 6810 .extra1 = (void *)SYSCTL_ZERO,
6813 .extra2 = (void *)&two_five_five, 6811 .extra2 = (void *)&two_five_five,
6814 }, 6812 },
6815 { 6813 {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4d2e6b31a8d6..8b0c33fb19a2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6031,9 +6031,6 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
6031 return 0; 6031 return 0;
6032} 6032}
6033 6033
6034static int zero;
6035static int one = 1;
6036
6037static struct ctl_table ipv6_route_table_template[] = { 6034static struct ctl_table ipv6_route_table_template[] = {
6038 { 6035 {
6039 .procname = "flush", 6036 .procname = "flush",
@@ -6111,8 +6108,8 @@ static struct ctl_table ipv6_route_table_template[] = {
6111 .maxlen = sizeof(int), 6108 .maxlen = sizeof(int),
6112 .mode = 0644, 6109 .mode = 0644,
6113 .proc_handler = proc_dointvec_minmax, 6110 .proc_handler = proc_dointvec_minmax,
6114 .extra1 = &zero, 6111 .extra1 = SYSCTL_ZERO,
6115 .extra2 = &one, 6112 .extra2 = SYSCTL_ONE,
6116 }, 6113 },
6117 { } 6114 { }
6118}; 6115};
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index dc4c91e0bfb8..ec8fcfc60a27 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -21,8 +21,6 @@
21#include <net/calipso.h> 21#include <net/calipso.h>
22#endif 22#endif
23 23
24static int zero;
25static int one = 1;
26static int flowlabel_reflect_max = 0x7; 24static int flowlabel_reflect_max = 0x7;
27static int auto_flowlabels_min; 25static int auto_flowlabels_min;
28static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; 26static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
@@ -115,7 +113,7 @@ static struct ctl_table ipv6_table_template[] = {
115 .maxlen = sizeof(int), 113 .maxlen = sizeof(int),
116 .mode = 0644, 114 .mode = 0644,
117 .proc_handler = proc_dointvec_minmax, 115 .proc_handler = proc_dointvec_minmax,
118 .extra1 = &zero, 116 .extra1 = SYSCTL_ZERO,
119 .extra2 = &flowlabel_reflect_max, 117 .extra2 = &flowlabel_reflect_max,
120 }, 118 },
121 { 119 {
@@ -152,8 +150,8 @@ static struct ctl_table ipv6_table_template[] = {
152 .maxlen = sizeof(int), 150 .maxlen = sizeof(int),
153 .mode = 0644, 151 .mode = 0644,
154 .proc_handler = proc_rt6_multipath_hash_policy, 152 .proc_handler = proc_rt6_multipath_hash_policy,
155 .extra1 = &zero, 153 .extra1 = SYSCTL_ZERO,
156 .extra2 = &one, 154 .extra2 = SYSCTL_ONE,
157 }, 155 },
158 { 156 {
159 .procname = "seg6_flowlabel", 157 .procname = "seg6_flowlabel",
@@ -179,7 +177,7 @@ static struct ctl_table ipv6_rotable[] = {
179 .maxlen = sizeof(int), 177 .maxlen = sizeof(int),
180 .mode = 0644, 178 .mode = 0644,
181 .proc_handler = proc_dointvec_minmax, 179 .proc_handler = proc_dointvec_minmax,
182 .extra1 = &one 180 .extra1 = SYSCTL_ONE
183 }, 181 },
184#ifdef CONFIG_NETLABEL 182#ifdef CONFIG_NETLABEL
185 { 183 {
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 198ec4fe4148..c312741df2ce 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -37,8 +37,6 @@
37 37
38#define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1) 38#define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1)
39 39
40static int zero = 0;
41static int one = 1;
42static int label_limit = (1 << 20) - 1; 40static int label_limit = (1 << 20) - 1;
43static int ttl_max = 255; 41static int ttl_max = 255;
44 42
@@ -2607,7 +2605,7 @@ static int mpls_platform_labels(struct ctl_table *table, int write,
2607 .data = &platform_labels, 2605 .data = &platform_labels,
2608 .maxlen = sizeof(int), 2606 .maxlen = sizeof(int),
2609 .mode = table->mode, 2607 .mode = table->mode,
2610 .extra1 = &zero, 2608 .extra1 = SYSCTL_ZERO,
2611 .extra2 = &label_limit, 2609 .extra2 = &label_limit,
2612 }; 2610 };
2613 2611
@@ -2636,8 +2634,8 @@ static const struct ctl_table mpls_table[] = {
2636 .maxlen = sizeof(int), 2634 .maxlen = sizeof(int),
2637 .mode = 0644, 2635 .mode = 0644,
2638 .proc_handler = proc_dointvec_minmax, 2636 .proc_handler = proc_dointvec_minmax,
2639 .extra1 = &zero, 2637 .extra1 = SYSCTL_ZERO,
2640 .extra2 = &one, 2638 .extra2 = SYSCTL_ONE,
2641 }, 2639 },
2642 { 2640 {
2643 .procname = "default_ttl", 2641 .procname = "default_ttl",
@@ -2645,7 +2643,7 @@ static const struct ctl_table mpls_table[] = {
2645 .maxlen = sizeof(int), 2643 .maxlen = sizeof(int),
2646 .mode = 0644, 2644 .mode = 0644,
2647 .proc_handler = proc_dointvec_minmax, 2645 .proc_handler = proc_dointvec_minmax,
2648 .extra1 = &one, 2646 .extra1 = SYSCTL_ONE,
2649 .extra2 = &ttl_max, 2647 .extra2 = &ttl_max,
2650 }, 2648 },
2651 { } 2649 { }
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 07e0967bf129..060565e7d227 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1726,7 +1726,6 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs)
1726 1726
1727#ifdef CONFIG_SYSCTL 1727#ifdef CONFIG_SYSCTL
1728 1728
1729static int zero;
1730static int three = 3; 1729static int three = 3;
1731 1730
1732static int 1731static int
@@ -1935,7 +1934,7 @@ static struct ctl_table vs_vars[] = {
1935 .maxlen = sizeof(int), 1934 .maxlen = sizeof(int),
1936 .mode = 0644, 1935 .mode = 0644,
1937 .proc_handler = proc_dointvec_minmax, 1936 .proc_handler = proc_dointvec_minmax,
1938 .extra1 = &zero, 1937 .extra1 = SYSCTL_ZERO,
1939 .extra2 = &three, 1938 .extra2 = &three,
1940 }, 1939 },
1941 { 1940 {
diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
index 1e3fa67d91aa..2bbb38161851 100644
--- a/net/rxrpc/sysctl.c
+++ b/net/rxrpc/sysctl.c
@@ -11,7 +11,6 @@
11#include "ar-internal.h" 11#include "ar-internal.h"
12 12
13static struct ctl_table_header *rxrpc_sysctl_reg_table; 13static struct ctl_table_header *rxrpc_sysctl_reg_table;
14static const unsigned int one = 1;
15static const unsigned int four = 4; 14static const unsigned int four = 4;
16static const unsigned int thirtytwo = 32; 15static const unsigned int thirtytwo = 32;
17static const unsigned int n_65535 = 65535; 16static const unsigned int n_65535 = 65535;
@@ -97,7 +96,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
97 .maxlen = sizeof(unsigned int), 96 .maxlen = sizeof(unsigned int),
98 .mode = 0644, 97 .mode = 0644,
99 .proc_handler = proc_dointvec_minmax, 98 .proc_handler = proc_dointvec_minmax,
100 .extra1 = (void *)&one, 99 .extra1 = (void *)SYSCTL_ONE,
101 .extra2 = (void *)&rxrpc_max_client_connections, 100 .extra2 = (void *)&rxrpc_max_client_connections,
102 }, 101 },
103 { 102 {
@@ -115,7 +114,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
115 .maxlen = sizeof(unsigned int), 114 .maxlen = sizeof(unsigned int),
116 .mode = 0644, 115 .mode = 0644,
117 .proc_handler = proc_dointvec_minmax, 116 .proc_handler = proc_dointvec_minmax,
118 .extra1 = (void *)&one, 117 .extra1 = (void *)SYSCTL_ONE,
119 .extra2 = (void *)&n_max_acks, 118 .extra2 = (void *)&n_max_acks,
120 }, 119 },
121 { 120 {
@@ -124,7 +123,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
124 .maxlen = sizeof(unsigned int), 123 .maxlen = sizeof(unsigned int),
125 .mode = 0644, 124 .mode = 0644,
126 .proc_handler = proc_dointvec_minmax, 125 .proc_handler = proc_dointvec_minmax,
127 .extra1 = (void *)&one, 126 .extra1 = (void *)SYSCTL_ONE,
128 .extra2 = (void *)&n_65535, 127 .extra2 = (void *)&n_65535,
129 }, 128 },
130 { 129 {
@@ -133,7 +132,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
133 .maxlen = sizeof(unsigned int), 132 .maxlen = sizeof(unsigned int),
134 .mode = 0644, 133 .mode = 0644,
135 .proc_handler = proc_dointvec_minmax, 134 .proc_handler = proc_dointvec_minmax,
136 .extra1 = (void *)&one, 135 .extra1 = (void *)SYSCTL_ONE,
137 .extra2 = (void *)&four, 136 .extra2 = (void *)&four,
138 }, 137 },
139 138
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 9a19147902f1..1250751bca1b 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -25,10 +25,7 @@
25#include <net/sctp/sctp.h> 25#include <net/sctp/sctp.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27 27
28static int zero = 0;
29static int one = 1;
30static int timer_max = 86400000; /* ms in one day */ 28static int timer_max = 86400000; /* ms in one day */
31static int int_max = INT_MAX;
32static int sack_timer_min = 1; 29static int sack_timer_min = 1;
33static int sack_timer_max = 500; 30static int sack_timer_max = 500;
34static int addr_scope_max = SCTP_SCOPE_POLICY_MAX; 31static int addr_scope_max = SCTP_SCOPE_POLICY_MAX;
@@ -92,7 +89,7 @@ static struct ctl_table sctp_net_table[] = {
92 .maxlen = sizeof(unsigned int), 89 .maxlen = sizeof(unsigned int),
93 .mode = 0644, 90 .mode = 0644,
94 .proc_handler = proc_dointvec_minmax, 91 .proc_handler = proc_dointvec_minmax,
95 .extra1 = &one, 92 .extra1 = SYSCTL_ONE,
96 .extra2 = &timer_max 93 .extra2 = &timer_max
97 }, 94 },
98 { 95 {
@@ -101,7 +98,7 @@ static struct ctl_table sctp_net_table[] = {
101 .maxlen = sizeof(unsigned int), 98 .maxlen = sizeof(unsigned int),
102 .mode = 0644, 99 .mode = 0644,
103 .proc_handler = proc_sctp_do_rto_min, 100 .proc_handler = proc_sctp_do_rto_min,
104 .extra1 = &one, 101 .extra1 = SYSCTL_ONE,
105 .extra2 = &init_net.sctp.rto_max 102 .extra2 = &init_net.sctp.rto_max
106 }, 103 },
107 { 104 {
@@ -137,8 +134,8 @@ static struct ctl_table sctp_net_table[] = {
137 .maxlen = sizeof(int), 134 .maxlen = sizeof(int),
138 .mode = 0644, 135 .mode = 0644,
139 .proc_handler = proc_dointvec_minmax, 136 .proc_handler = proc_dointvec_minmax,
140 .extra1 = &zero, 137 .extra1 = SYSCTL_ZERO,
141 .extra2 = &int_max 138 .extra2 = SYSCTL_INT_MAX,
142 }, 139 },
143 { 140 {
144 .procname = "cookie_preserve_enable", 141 .procname = "cookie_preserve_enable",
@@ -160,7 +157,7 @@ static struct ctl_table sctp_net_table[] = {
160 .maxlen = sizeof(unsigned int), 157 .maxlen = sizeof(unsigned int),
161 .mode = 0644, 158 .mode = 0644,
162 .proc_handler = proc_dointvec_minmax, 159 .proc_handler = proc_dointvec_minmax,
163 .extra1 = &one, 160 .extra1 = SYSCTL_ONE,
164 .extra2 = &timer_max 161 .extra2 = &timer_max
165 }, 162 },
166 { 163 {
@@ -178,7 +175,7 @@ static struct ctl_table sctp_net_table[] = {
178 .maxlen = sizeof(unsigned int), 175 .maxlen = sizeof(unsigned int),
179 .mode = 0644, 176 .mode = 0644,
180 .proc_handler = proc_dointvec_minmax, 177 .proc_handler = proc_dointvec_minmax,
181 .extra1 = &one, 178 .extra1 = SYSCTL_ONE,
182 .extra2 = &timer_max 179 .extra2 = &timer_max
183 }, 180 },
184 { 181 {
@@ -187,8 +184,8 @@ static struct ctl_table sctp_net_table[] = {
187 .maxlen = sizeof(int), 184 .maxlen = sizeof(int),
188 .mode = 0644, 185 .mode = 0644,
189 .proc_handler = proc_dointvec_minmax, 186 .proc_handler = proc_dointvec_minmax,
190 .extra1 = &one, 187 .extra1 = SYSCTL_ONE,
191 .extra2 = &int_max 188 .extra2 = SYSCTL_INT_MAX,
192 }, 189 },
193 { 190 {
194 .procname = "path_max_retrans", 191 .procname = "path_max_retrans",
@@ -196,8 +193,8 @@ static struct ctl_table sctp_net_table[] = {
196 .maxlen = sizeof(int), 193 .maxlen = sizeof(int),
197 .mode = 0644, 194 .mode = 0644,
198 .proc_handler = proc_dointvec_minmax, 195 .proc_handler = proc_dointvec_minmax,
199 .extra1 = &one, 196 .extra1 = SYSCTL_ONE,
200 .extra2 = &int_max 197 .extra2 = SYSCTL_INT_MAX,
201 }, 198 },
202 { 199 {
203 .procname = "max_init_retransmits", 200 .procname = "max_init_retransmits",
@@ -205,8 +202,8 @@ static struct ctl_table sctp_net_table[] = {
205 .maxlen = sizeof(int), 202 .maxlen = sizeof(int),
206 .mode = 0644, 203 .mode = 0644,
207 .proc_handler = proc_dointvec_minmax, 204 .proc_handler = proc_dointvec_minmax,
208 .extra1 = &one, 205 .extra1 = SYSCTL_ONE,
209 .extra2 = &int_max 206 .extra2 = SYSCTL_INT_MAX,
210 }, 207 },
211 { 208 {
212 .procname = "pf_retrans", 209 .procname = "pf_retrans",
@@ -214,8 +211,8 @@ static struct ctl_table sctp_net_table[] = {
214 .maxlen = sizeof(int), 211 .maxlen = sizeof(int),
215 .mode = 0644, 212 .mode = 0644,
216 .proc_handler = proc_dointvec_minmax, 213 .proc_handler = proc_dointvec_minmax,
217 .extra1 = &zero, 214 .extra1 = SYSCTL_ZERO,
218 .extra2 = &int_max 215 .extra2 = SYSCTL_INT_MAX,
219 }, 216 },
220 { 217 {
221 .procname = "sndbuf_policy", 218 .procname = "sndbuf_policy",
@@ -286,7 +283,7 @@ static struct ctl_table sctp_net_table[] = {
286 .maxlen = sizeof(int), 283 .maxlen = sizeof(int),
287 .mode = 0644, 284 .mode = 0644,
288 .proc_handler = proc_dointvec_minmax, 285 .proc_handler = proc_dointvec_minmax,
289 .extra1 = &zero, 286 .extra1 = SYSCTL_ZERO,
290 .extra2 = &addr_scope_max, 287 .extra2 = &addr_scope_max,
291 }, 288 },
292 { 289 {
@@ -295,7 +292,7 @@ static struct ctl_table sctp_net_table[] = {
295 .maxlen = sizeof(int), 292 .maxlen = sizeof(int),
296 .mode = 0644, 293 .mode = 0644,
297 .proc_handler = &proc_dointvec_minmax, 294 .proc_handler = &proc_dointvec_minmax,
298 .extra1 = &one, 295 .extra1 = SYSCTL_ONE,
299 .extra2 = &rwnd_scale_max, 296 .extra2 = &rwnd_scale_max,
300 }, 297 },
301 { 298 {
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 1f73a6a7e43c..ffb1684c4573 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -80,7 +80,6 @@ static unsigned int min_slot_table_size = RPCRDMA_MIN_SLOT_TABLE;
80static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE; 80static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE;
81static unsigned int min_inline_size = RPCRDMA_MIN_INLINE; 81static unsigned int min_inline_size = RPCRDMA_MIN_INLINE;
82static unsigned int max_inline_size = RPCRDMA_MAX_INLINE; 82static unsigned int max_inline_size = RPCRDMA_MAX_INLINE;
83static unsigned int zero;
84static unsigned int max_padding = PAGE_SIZE; 83static unsigned int max_padding = PAGE_SIZE;
85static unsigned int min_memreg = RPCRDMA_BOUNCEBUFFERS; 84static unsigned int min_memreg = RPCRDMA_BOUNCEBUFFERS;
86static unsigned int max_memreg = RPCRDMA_LAST - 1; 85static unsigned int max_memreg = RPCRDMA_LAST - 1;
@@ -122,7 +121,7 @@ static struct ctl_table xr_tunables_table[] = {
122 .maxlen = sizeof(unsigned int), 121 .maxlen = sizeof(unsigned int),
123 .mode = 0644, 122 .mode = 0644,
124 .proc_handler = proc_dointvec_minmax, 123 .proc_handler = proc_dointvec_minmax,
125 .extra1 = &zero, 124 .extra1 = SYSCTL_ZERO,
126 .extra2 = &max_padding, 125 .extra2 = &max_padding,
127 }, 126 },
128 { 127 {
diff --git a/net/tipc/sysctl.c b/net/tipc/sysctl.c
index 9df82a573aa7..6159d327db76 100644
--- a/net/tipc/sysctl.c
+++ b/net/tipc/sysctl.c
@@ -38,8 +38,6 @@
38 38
39#include <linux/sysctl.h> 39#include <linux/sysctl.h>
40 40
41static int zero;
42static int one = 1;
43static struct ctl_table_header *tipc_ctl_hdr; 41static struct ctl_table_header *tipc_ctl_hdr;
44 42
45static struct ctl_table tipc_table[] = { 43static struct ctl_table tipc_table[] = {
@@ -49,7 +47,7 @@ static struct ctl_table tipc_table[] = {
49 .maxlen = sizeof(sysctl_tipc_rmem), 47 .maxlen = sizeof(sysctl_tipc_rmem),
50 .mode = 0644, 48 .mode = 0644,
51 .proc_handler = proc_dointvec_minmax, 49 .proc_handler = proc_dointvec_minmax,
52 .extra1 = &one, 50 .extra1 = SYSCTL_ONE,
53 }, 51 },
54 { 52 {
55 .procname = "named_timeout", 53 .procname = "named_timeout",
@@ -57,7 +55,7 @@ static struct ctl_table tipc_table[] = {
57 .maxlen = sizeof(sysctl_tipc_named_timeout), 55 .maxlen = sizeof(sysctl_tipc_named_timeout),
58 .mode = 0644, 56 .mode = 0644,
59 .proc_handler = proc_dointvec_minmax, 57 .proc_handler = proc_dointvec_minmax,
60 .extra1 = &zero, 58 .extra1 = SYSCTL_ZERO,
61 }, 59 },
62 { 60 {
63 .procname = "sk_filter", 61 .procname = "sk_filter",
diff --git a/security/keys/sysctl.c b/security/keys/sysctl.c
index dd1e21fab827..b46b651b3c4c 100644
--- a/security/keys/sysctl.c
+++ b/security/keys/sysctl.c
@@ -9,8 +9,6 @@
9#include <linux/sysctl.h> 9#include <linux/sysctl.h>
10#include "internal.h" 10#include "internal.h"
11 11
12static const int zero, one = 1, max = INT_MAX;
13
14struct ctl_table key_sysctls[] = { 12struct ctl_table key_sysctls[] = {
15 { 13 {
16 .procname = "maxkeys", 14 .procname = "maxkeys",
@@ -18,8 +16,8 @@ struct ctl_table key_sysctls[] = {
18 .maxlen = sizeof(unsigned), 16 .maxlen = sizeof(unsigned),
19 .mode = 0644, 17 .mode = 0644,
20 .proc_handler = proc_dointvec_minmax, 18 .proc_handler = proc_dointvec_minmax,
21 .extra1 = (void *) &one, 19 .extra1 = (void *) SYSCTL_ONE,
22 .extra2 = (void *) &max, 20 .extra2 = (void *) SYSCTL_INT_MAX,
23 }, 21 },
24 { 22 {
25 .procname = "maxbytes", 23 .procname = "maxbytes",
@@ -27,8 +25,8 @@ struct ctl_table key_sysctls[] = {
27 .maxlen = sizeof(unsigned), 25 .maxlen = sizeof(unsigned),
28 .mode = 0644, 26 .mode = 0644,
29 .proc_handler = proc_dointvec_minmax, 27 .proc_handler = proc_dointvec_minmax,
30 .extra1 = (void *) &one, 28 .extra1 = (void *) SYSCTL_ONE,
31 .extra2 = (void *) &max, 29 .extra2 = (void *) SYSCTL_INT_MAX,
32 }, 30 },
33 { 31 {
34 .procname = "root_maxkeys", 32 .procname = "root_maxkeys",
@@ -36,8 +34,8 @@ struct ctl_table key_sysctls[] = {
36 .maxlen = sizeof(unsigned), 34 .maxlen = sizeof(unsigned),
37 .mode = 0644, 35 .mode = 0644,
38 .proc_handler = proc_dointvec_minmax, 36 .proc_handler = proc_dointvec_minmax,
39 .extra1 = (void *) &one, 37 .extra1 = (void *) SYSCTL_ONE,
40 .extra2 = (void *) &max, 38 .extra2 = (void *) SYSCTL_INT_MAX,
41 }, 39 },
42 { 40 {
43 .procname = "root_maxbytes", 41 .procname = "root_maxbytes",
@@ -45,8 +43,8 @@ struct ctl_table key_sysctls[] = {
45 .maxlen = sizeof(unsigned), 43 .maxlen = sizeof(unsigned),
46 .mode = 0644, 44 .mode = 0644,
47 .proc_handler = proc_dointvec_minmax, 45 .proc_handler = proc_dointvec_minmax,
48 .extra1 = (void *) &one, 46 .extra1 = (void *) SYSCTL_ONE,
49 .extra2 = (void *) &max, 47 .extra2 = (void *) SYSCTL_INT_MAX,
50 }, 48 },
51 { 49 {
52 .procname = "gc_delay", 50 .procname = "gc_delay",
@@ -54,8 +52,8 @@ struct ctl_table key_sysctls[] = {
54 .maxlen = sizeof(unsigned), 52 .maxlen = sizeof(unsigned),
55 .mode = 0644, 53 .mode = 0644,
56 .proc_handler = proc_dointvec_minmax, 54 .proc_handler = proc_dointvec_minmax,
57 .extra1 = (void *) &zero, 55 .extra1 = (void *) SYSCTL_ZERO,
58 .extra2 = (void *) &max, 56 .extra2 = (void *) SYSCTL_INT_MAX,
59 }, 57 },
60#ifdef CONFIG_PERSISTENT_KEYRINGS 58#ifdef CONFIG_PERSISTENT_KEYRINGS
61 { 59 {
@@ -64,8 +62,8 @@ struct ctl_table key_sysctls[] = {
64 .maxlen = sizeof(unsigned), 62 .maxlen = sizeof(unsigned),
65 .mode = 0644, 63 .mode = 0644,
66 .proc_handler = proc_dointvec_minmax, 64 .proc_handler = proc_dointvec_minmax,
67 .extra1 = (void *) &zero, 65 .extra1 = (void *) SYSCTL_ZERO,
68 .extra2 = (void *) &max, 66 .extra2 = (void *) SYSCTL_INT_MAX,
69 }, 67 },
70#endif 68#endif
71 { } 69 { }
diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
index 81519c804888..ee5cb944f4ad 100644
--- a/security/loadpin/loadpin.c
+++ b/security/loadpin/loadpin.c
@@ -43,8 +43,6 @@ static struct super_block *pinned_root;
43static DEFINE_SPINLOCK(pinned_root_spinlock); 43static DEFINE_SPINLOCK(pinned_root_spinlock);
44 44
45#ifdef CONFIG_SYSCTL 45#ifdef CONFIG_SYSCTL
46static int zero;
47static int one = 1;
48 46
49static struct ctl_path loadpin_sysctl_path[] = { 47static struct ctl_path loadpin_sysctl_path[] = {
50 { .procname = "kernel", }, 48 { .procname = "kernel", },
@@ -59,8 +57,8 @@ static struct ctl_table loadpin_sysctl_table[] = {
59 .maxlen = sizeof(int), 57 .maxlen = sizeof(int),
60 .mode = 0644, 58 .mode = 0644,
61 .proc_handler = proc_dointvec_minmax, 59 .proc_handler = proc_dointvec_minmax,
62 .extra1 = &zero, 60 .extra1 = SYSCTL_ZERO,
63 .extra2 = &one, 61 .extra2 = SYSCTL_ONE,
64 }, 62 },
65 { } 63 { }
66}; 64};
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 01c6239c4493..94dc346370b1 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -445,7 +445,6 @@ static int yama_dointvec_minmax(struct ctl_table *table, int write,
445 return proc_dointvec_minmax(&table_copy, write, buffer, lenp, ppos); 445 return proc_dointvec_minmax(&table_copy, write, buffer, lenp, ppos);
446} 446}
447 447
448static int zero;
449static int max_scope = YAMA_SCOPE_NO_ATTACH; 448static int max_scope = YAMA_SCOPE_NO_ATTACH;
450 449
451static struct ctl_path yama_sysctl_path[] = { 450static struct ctl_path yama_sysctl_path[] = {
@@ -461,7 +460,7 @@ static struct ctl_table yama_sysctl_table[] = {
461 .maxlen = sizeof(int), 460 .maxlen = sizeof(int),
462 .mode = 0644, 461 .mode = 0644,
463 .proc_handler = yama_dointvec_minmax, 462 .proc_handler = yama_dointvec_minmax,
464 .extra1 = &zero, 463 .extra1 = SYSCTL_ZERO,
465 .extra2 = &max_scope, 464 .extra2 = &max_scope,
466 }, 465 },
467 { } 466 { }