You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
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>
This commit is contained in:
committed by
Linus Torvalds
parent
371096949f
commit
eec4844fae
@@ -220,15 +220,13 @@ appldata_timer_handler(struct ctl_table *ctl, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
int timer_active = appldata_timer_active;
|
||||
int zero = 0;
|
||||
int one = 1;
|
||||
int rc;
|
||||
struct ctl_table ctl_entry = {
|
||||
.procname = ctl->procname,
|
||||
.data = &timer_active,
|
||||
.maxlen = sizeof(int),
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
};
|
||||
|
||||
rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
|
||||
@@ -255,13 +253,12 @@ appldata_interval_handler(struct ctl_table *ctl, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
int interval = appldata_interval;
|
||||
int one = 1;
|
||||
int rc;
|
||||
struct ctl_table ctl_entry = {
|
||||
.procname = ctl->procname,
|
||||
.data = &interval,
|
||||
.maxlen = sizeof(int),
|
||||
.extra1 = &one,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
};
|
||||
|
||||
rc = proc_dointvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
|
||||
@@ -289,13 +286,11 @@ appldata_generic_handler(struct ctl_table *ctl, int write,
|
||||
struct list_head *lh;
|
||||
int rc, found;
|
||||
int active;
|
||||
int zero = 0;
|
||||
int one = 1;
|
||||
struct ctl_table ctl_entry = {
|
||||
.data = &active,
|
||||
.maxlen = sizeof(int),
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
};
|
||||
|
||||
found = 0;
|
||||
|
||||
@@ -587,15 +587,13 @@ static int topology_ctl_handler(struct ctl_table *ctl, int write,
|
||||
{
|
||||
int enabled = topology_is_enabled();
|
||||
int new_mode;
|
||||
int zero = 0;
|
||||
int one = 1;
|
||||
int rc;
|
||||
struct ctl_table ctl_entry = {
|
||||
.procname = ctl->procname,
|
||||
.data = &enabled,
|
||||
.maxlen = sizeof(int),
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
};
|
||||
|
||||
rc = proc_douintvec_minmax(&ctl_entry, write, buffer, lenp, ppos);
|
||||
|
||||
@@ -65,9 +65,6 @@ subsys_initcall(sysenter_setup);
|
||||
/* Register vsyscall32 into the ABI table */
|
||||
#include <linux/sysctl.h>
|
||||
|
||||
static const int zero;
|
||||
static const int one = 1;
|
||||
|
||||
static struct ctl_table abi_table2[] = {
|
||||
{
|
||||
.procname = "vsyscall32",
|
||||
@@ -75,8 +72,8 @@ static struct ctl_table abi_table2[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = (int *)&zero,
|
||||
.extra2 = (int *)&one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -65,8 +65,6 @@ static int sched_itmt_update_handler(struct ctl_table *table, int write,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static unsigned int zero;
|
||||
static unsigned int one = 1;
|
||||
static struct ctl_table itmt_kern_table[] = {
|
||||
{
|
||||
.procname = "sched_itmt_enabled",
|
||||
@@ -74,8 +72,8 @@ static struct ctl_table itmt_kern_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = sched_itmt_update_handler,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
* firmware fallback configuration table
|
||||
*/
|
||||
|
||||
static unsigned int zero;
|
||||
static unsigned int one = 1;
|
||||
|
||||
struct firmware_fallback_config fw_fallback_config = {
|
||||
.force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
|
||||
.loading_timeout = 60,
|
||||
@@ -26,6 +23,7 @@ struct firmware_fallback_config fw_fallback_config = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(fw_fallback_config);
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
struct ctl_table firmware_config_table[] = {
|
||||
{
|
||||
.procname = "force_sysfs_fallback",
|
||||
@@ -33,8 +31,8 @@ struct ctl_table firmware_config_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_douintvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "ignore_sysfs_fallback",
|
||||
@@ -42,9 +40,10 @@ struct ctl_table firmware_config_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_douintvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(firmware_config_table);
|
||||
#endif
|
||||
|
||||
@@ -274,8 +274,6 @@
|
||||
#define POLL_PERIOD (NSEC_PER_SEC / POLL_FREQUENCY)
|
||||
|
||||
/* for sysctl proc_dointvec_minmax of dev.i915.perf_stream_paranoid */
|
||||
static int zero;
|
||||
static int one = 1;
|
||||
static u32 i915_perf_stream_paranoid = true;
|
||||
|
||||
/* The maximum exponent the hardware accepts is 63 (essentially it selects one
|
||||
@@ -3366,8 +3364,8 @@ static struct ctl_table oa_table[] = {
|
||||
.maxlen = sizeof(i915_perf_stream_paranoid),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "oa_max_sample_rate",
|
||||
@@ -3375,7 +3373,7 @@ static struct ctl_table oa_table[] = {
|
||||
.maxlen = sizeof(i915_oa_max_sample_rate),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &oa_sample_rate_hard_limit,
|
||||
},
|
||||
{}
|
||||
|
||||
@@ -1197,8 +1197,6 @@ static struct kmsg_dumper hv_kmsg_dumper = {
|
||||
};
|
||||
|
||||
static struct ctl_table_header *hv_ctl_table_hdr;
|
||||
static int zero;
|
||||
static int one = 1;
|
||||
|
||||
/*
|
||||
* sysctl option to allow the user to control whether kmsg data should be
|
||||
@@ -1211,8 +1209,8 @@ static struct ctl_table hv_ctl_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -855,8 +855,6 @@ void tty_ldisc_deinit(struct tty_struct *tty)
|
||||
tty->ldisc = NULL;
|
||||
}
|
||||
|
||||
static int zero;
|
||||
static int one = 1;
|
||||
static struct ctl_table tty_table[] = {
|
||||
{
|
||||
.procname = "ldisc_autoload",
|
||||
@@ -864,8 +862,8 @@ static struct ctl_table tty_table[] = {
|
||||
.maxlen = sizeof(tty_ldisc_autoload),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -77,9 +77,6 @@ static int xen_hotplug_unpopulated;
|
||||
|
||||
#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
|
||||
|
||||
static int zero;
|
||||
static int one = 1;
|
||||
|
||||
static struct ctl_table balloon_table[] = {
|
||||
{
|
||||
.procname = "hotplug_unpopulated",
|
||||
@@ -87,8 +84,8 @@ static struct ctl_table balloon_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -291,7 +291,7 @@ static LIST_HEAD(tfile_check_list);
|
||||
|
||||
#include <linux/sysctl.h>
|
||||
|
||||
static long zero;
|
||||
static long long_zero;
|
||||
static long long_max = LONG_MAX;
|
||||
|
||||
struct ctl_table epoll_table[] = {
|
||||
@@ -301,7 +301,7 @@ struct ctl_table epoll_table[] = {
|
||||
.maxlen = sizeof(max_user_watches),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_doulongvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = &long_zero,
|
||||
.extra2 = &long_max,
|
||||
},
|
||||
{ }
|
||||
|
||||
@@ -45,8 +45,6 @@ struct kmem_cache *inotify_inode_mark_cachep __read_mostly;
|
||||
|
||||
#include <linux/sysctl.h>
|
||||
|
||||
static int zero;
|
||||
|
||||
struct ctl_table inotify_table[] = {
|
||||
{
|
||||
.procname = "max_user_instances",
|
||||
@@ -54,7 +52,7 @@ struct ctl_table inotify_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "max_user_watches",
|
||||
@@ -62,7 +60,7 @@ struct ctl_table inotify_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "max_queued_events",
|
||||
@@ -70,7 +68,7 @@ struct ctl_table inotify_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero
|
||||
.extra1 = SYSCTL_ZERO
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -22,6 +22,10 @@ static const struct inode_operations proc_sys_inode_operations;
|
||||
static const struct file_operations proc_sys_dir_file_operations;
|
||||
static const struct inode_operations proc_sys_dir_operations;
|
||||
|
||||
/* shared constants to be used in various sysctls */
|
||||
const int sysctl_vals[] = { 0, 1, INT_MAX };
|
||||
EXPORT_SYMBOL(sysctl_vals);
|
||||
|
||||
/* Support for permanently empty directories */
|
||||
|
||||
struct ctl_table sysctl_mount_point[] = {
|
||||
|
||||
@@ -37,6 +37,13 @@ struct ctl_table_root;
|
||||
struct ctl_table_header;
|
||||
struct ctl_dir;
|
||||
|
||||
/* Keep the same order as in fs/proc/proc_sysctl.c */
|
||||
#define SYSCTL_ZERO ((void *)&sysctl_vals[0])
|
||||
#define SYSCTL_ONE ((void *)&sysctl_vals[1])
|
||||
#define SYSCTL_INT_MAX ((void *)&sysctl_vals[2])
|
||||
|
||||
extern const int sysctl_vals[];
|
||||
|
||||
typedef int proc_handler (struct ctl_table *ctl, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos);
|
||||
|
||||
|
||||
@@ -113,9 +113,6 @@ static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
|
||||
#define proc_ipc_sem_dointvec NULL
|
||||
#endif
|
||||
|
||||
static int zero;
|
||||
static int one = 1;
|
||||
static int int_max = INT_MAX;
|
||||
int ipc_mni = IPCMNI;
|
||||
int ipc_mni_shift = IPCMNI_SHIFT;
|
||||
int ipc_min_cycle = RADIX_TREE_MAP_SIZE;
|
||||
@@ -141,7 +138,7 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.shm_ctlmni),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &ipc_mni,
|
||||
},
|
||||
{
|
||||
@@ -150,8 +147,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.shm_rmid_forced),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax_orphans,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "msgmax",
|
||||
@@ -159,8 +156,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.msg_ctlmax),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
},
|
||||
{
|
||||
.procname = "msgmni",
|
||||
@@ -168,7 +165,7 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.msg_ctlmni),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &ipc_mni,
|
||||
},
|
||||
{
|
||||
@@ -177,8 +174,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_auto_msgmni,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "msgmnb",
|
||||
@@ -186,8 +183,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.msg_ctlmnb),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
},
|
||||
{
|
||||
.procname = "sem",
|
||||
@@ -203,8 +200,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
},
|
||||
{
|
||||
.procname = "msg_next_id",
|
||||
@@ -212,8 +209,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
},
|
||||
{
|
||||
.procname = "shm_next_id",
|
||||
@@ -221,8 +218,8 @@ static struct ctl_table ipc_kern_table[] = {
|
||||
.maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_ipc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
},
|
||||
#endif
|
||||
{}
|
||||
|
||||
@@ -291,14 +291,13 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
|
||||
}
|
||||
|
||||
extern int pid_max;
|
||||
static int zero = 0;
|
||||
static struct ctl_table pid_ns_ctl_table[] = {
|
||||
{
|
||||
.procname = "ns_last_pid",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0666, /* permissions are checked in the handler */
|
||||
.proc_handler = pid_ns_ctl_handler,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &pid_max,
|
||||
},
|
||||
{ }
|
||||
|
||||
197
kernel/sysctl.c
197
kernel/sysctl.c
File diff suppressed because it is too large
Load Diff
@@ -52,16 +52,14 @@ static struct ctl_table_root set_root = {
|
||||
.permissions = set_permissions,
|
||||
};
|
||||
|
||||
static int zero = 0;
|
||||
static int int_max = INT_MAX;
|
||||
#define UCOUNT_ENTRY(name) \
|
||||
{ \
|
||||
.procname = name, \
|
||||
.maxlen = sizeof(int), \
|
||||
.mode = 0644, \
|
||||
.proc_handler = proc_dointvec_minmax, \
|
||||
.extra1 = &zero, \
|
||||
.extra2 = &int_max, \
|
||||
.extra1 = SYSCTL_ZERO, \
|
||||
.extra2 = SYSCTL_INT_MAX, \
|
||||
}
|
||||
static struct ctl_table user_table[] = {
|
||||
UCOUNT_ENTRY("max_user_namespaces"),
|
||||
|
||||
@@ -3374,8 +3374,6 @@ void neigh_app_ns(struct neighbour *n)
|
||||
EXPORT_SYMBOL(neigh_app_ns);
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static int zero;
|
||||
static int int_max = INT_MAX;
|
||||
static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);
|
||||
|
||||
static 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,
|
||||
int size, ret;
|
||||
struct ctl_table tmp = *ctl;
|
||||
|
||||
tmp.extra1 = &zero;
|
||||
tmp.extra1 = SYSCTL_ZERO;
|
||||
tmp.extra2 = &unres_qlen_max;
|
||||
tmp.data = &size;
|
||||
|
||||
@@ -3449,8 +3447,8 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,
|
||||
struct ctl_table tmp = *ctl;
|
||||
int ret;
|
||||
|
||||
tmp.extra1 = &zero;
|
||||
tmp.extra2 = &int_max;
|
||||
tmp.extra1 = SYSCTL_ZERO;
|
||||
tmp.extra2 = SYSCTL_INT_MAX;
|
||||
|
||||
ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
|
||||
neigh_proc_update(ctl, write);
|
||||
@@ -3595,24 +3593,24 @@ static struct neigh_sysctl_table {
|
||||
.procname = "gc_thresh1",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
},
|
||||
[NEIGH_VAR_GC_THRESH2] = {
|
||||
.procname = "gc_thresh2",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
},
|
||||
[NEIGH_VAR_GC_THRESH3] = {
|
||||
.procname = "gc_thresh3",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &int_max,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_INT_MAX,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <net/busy_poll.h>
|
||||
#include <net/pkt_sched.h>
|
||||
|
||||
static int zero = 0;
|
||||
static int one = 1;
|
||||
static int two __maybe_unused = 2;
|
||||
static int min_sndbuf = SOCK_MIN_SNDBUF;
|
||||
static int min_rcvbuf = SOCK_MIN_RCVBUF;
|
||||
@@ -390,10 +388,10 @@ static struct ctl_table net_core_table[] = {
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax_bpf_enable,
|
||||
# ifdef CONFIG_BPF_JIT_ALWAYS_ON
|
||||
.extra1 = &one,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
# else
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &two,
|
||||
# endif
|
||||
},
|
||||
@@ -404,7 +402,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0600,
|
||||
.proc_handler = proc_dointvec_minmax_bpf_restricted,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &two,
|
||||
},
|
||||
{
|
||||
@@ -413,8 +411,8 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0600,
|
||||
.proc_handler = proc_dointvec_minmax_bpf_restricted,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
# endif
|
||||
{
|
||||
@@ -461,8 +459,8 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE
|
||||
},
|
||||
#ifdef CONFIG_RPS
|
||||
{
|
||||
@@ -493,7 +491,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "busy_read",
|
||||
@@ -501,7 +499,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
@@ -533,7 +531,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &one,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
.extra2 = &max_skb_frags,
|
||||
},
|
||||
{
|
||||
@@ -542,7 +540,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "fb_tunnels_only_for_init_net",
|
||||
@@ -550,8 +548,8 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra2 = &one,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
{
|
||||
.procname = "devconf_inherit_init_net",
|
||||
@@ -559,7 +557,7 @@ static struct ctl_table net_core_table[] = {
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &two,
|
||||
},
|
||||
{
|
||||
@@ -578,7 +576,7 @@ static struct ctl_table netns_core_table[] = {
|
||||
.data = &init_net.core.sysctl_somaxconn,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.proc_handler = proc_dointvec_minmax
|
||||
},
|
||||
{ }
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
#endif
|
||||
|
||||
/* Boundary values */
|
||||
static int zero = 0,
|
||||
one = 1,
|
||||
u8_max = 0xFF;
|
||||
static int u8_max = 0xFF;
|
||||
static unsigned long seqw_min = DCCPF_SEQ_WMIN,
|
||||
seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
|
||||
|
||||
@@ -38,7 +36,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_rx_ccid),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &u8_max, /* RFC 4340, 10. */
|
||||
},
|
||||
{
|
||||
@@ -47,7 +45,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_tx_ccid),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &u8_max, /* RFC 4340, 10. */
|
||||
},
|
||||
{
|
||||
@@ -56,7 +54,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_request_retries),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &one,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
.extra2 = &u8_max,
|
||||
},
|
||||
{
|
||||
@@ -65,7 +63,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_retries1),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &u8_max,
|
||||
},
|
||||
{
|
||||
@@ -74,7 +72,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_retries2),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = &u8_max,
|
||||
},
|
||||
{
|
||||
@@ -83,7 +81,7 @@ static struct ctl_table dccp_default_table[] = {
|
||||
.maxlen = sizeof(sysctl_dccp_tx_qlen),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = &zero,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "sync_ratelimit",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user