@@ -16,7 +16,7 @@
static unsigned int isa_membase, isa_portbase, isa_portshift;
-static struct ctl_table ctl_isa_vars[4] = {
+static struct ctl_table ctl_isa_vars[] = {
{
.procname = "membase",
.data = &isa_membase,
@@ -35,7 +35,7 @@ static struct ctl_table ctl_isa_vars[4] = {
.maxlen = sizeof(isa_portshift),
.mode = 0444,
.proc_handler = proc_dointvec,
- }, {}
+ }
};
static struct ctl_table_header *isa_sysctl_header;
@@ -52,10 +52,8 @@ struct insn_emulation {
int min;
int max;
- /*
- * sysctl for this emulation + a sentinal entry.
- */
- struct ctl_table sysctl[2];
+ /* sysctl for this emulation */
+ struct ctl_table sysctl;
};
#define ARM_OPCODE_CONDTEST_FAIL 0
@@ -558,7 +556,7 @@ static void __init register_insn_emulation(struct insn_emulation *insn)
update_insn_emulation_mode(insn, INSN_UNDEF);
if (insn->status != INSN_UNAVAILABLE) {
- sysctl = &insn->sysctl[0];
+ sysctl = &insn->sysctl;
sysctl->mode = 0644;
sysctl->maxlen = sizeof(int);
@@ -588,8 +588,7 @@ static struct ctl_table sve_default_vl_table[] = {
.mode = 0644,
.proc_handler = vec_proc_do_default_vl,
.extra1 = &vl_info[ARM64_VEC_SVE],
- },
- { }
+ }
};
static int __init sve_sysctl_init(void)
@@ -613,8 +612,7 @@ static struct ctl_table sme_default_vl_table[] = {
.mode = 0644,
.proc_handler = vec_proc_do_default_vl,
.extra1 = &vl_info[ARM64_VEC_SME],
- },
- { }
+ }
};
static int __init sme_sysctl_init(void)
@@ -723,8 +723,7 @@ static struct ctl_table tagged_addr_sysctl_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init tagged_addr_init(void)
@@ -231,8 +231,7 @@ static struct ctl_table kdump_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
#endif
@@ -104,8 +104,7 @@ static struct ctl_table powersave_nap_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- {}
+ }
};
static int __init
@@ -59,8 +59,7 @@ static struct ctl_table nmi_wd_lpm_factor_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_douintvec_minmax,
- },
- {}
+ }
};
static int __init register_nmi_wd_lpm_factor_sysctl(void)
@@ -62,8 +62,7 @@ static struct ctl_table appldata_table[] = {
.procname = "interval",
.mode = S_IRUGO | S_IWUSR,
.proc_handler = appldata_interval_handler,
- },
- { },
+ }
};
/*
@@ -352,7 +351,7 @@ int appldata_register_ops(struct appldata_ops *ops)
return -EINVAL;
/* The last entry must be an empty one */
- ops->ctl_table = kcalloc(2, sizeof(struct ctl_table), GFP_KERNEL);
+ ops->ctl_table = kcalloc(1, sizeof(struct ctl_table), GFP_KERNEL);
if (!ops->ctl_table)
return -ENOMEM;
@@ -365,7 +364,7 @@ int appldata_register_ops(struct appldata_ops *ops)
ops->ctl_table[0].proc_handler = appldata_generic_handler;
ops->ctl_table[0].data = ops;
- ops->sysctl_header = register_sysctl(appldata_proc_name, ops->ctl_table);
+ ops->sysctl_header = register_sysctl(appldata_proc_name, ops->ctl_table, 1);
if (!ops->sysctl_header)
goto out;
return 0;
@@ -977,8 +977,7 @@ static struct ctl_table s390dbf_table[] = {
.maxlen = sizeof(int),
.mode = S_IRUGO | S_IWUSR,
.proc_handler = s390dbf_procactive,
- },
- { }
+ }
};
static struct ctl_table_header *s390dbf_sysctl_header;
@@ -633,8 +633,7 @@ static struct ctl_table topology_ctl_table[] = {
.procname = "topology",
.mode = 0644,
.proc_handler = topology_ctl_handler,
- },
- { },
+ }
};
static int __init topology_init(void)
@@ -331,8 +331,7 @@ static struct ctl_table cmm_table[] = {
.procname = "cmm_timeout",
.mode = 0644,
.proc_handler = cmm_timeout_handler,
- },
- { }
+ }
};
#ifdef CONFIG_CMM_IUCV
@@ -29,8 +29,7 @@ static struct ctl_table page_table_sysctl[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init page_table_register_sysctl(void)
@@ -66,8 +66,7 @@ static struct ctl_table abi_table2[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static __init int ia32_binfmt_init(void)
@@ -1189,8 +1189,7 @@ static struct ctl_table sld_sysctls[] = {
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static int __init sld_mitigate_sysctl_init(void)
@@ -73,8 +73,7 @@ static struct ctl_table itmt_kern_table[] = {
.proc_handler = sched_itmt_update_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static struct ctl_table_header *itmt_sysctl_header;
@@ -62,8 +62,7 @@ static struct ctl_table crypto_sysctl_table[] = {
.maxlen = 64,
.mode = 0444,
.proc_handler = proc_dostring
- },
- {}
+ }
};
static struct ctl_table_header *crypto_sysctls;
@@ -43,8 +43,7 @@ static struct ctl_table firmware_config_table[] = {
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static struct ctl_table_header *firmware_config_sysct_table_header;
@@ -3668,8 +3668,7 @@ static struct ctl_table cdrom_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = cdrom_sysctl_handler
- },
- { }
+ }
};
static struct ctl_table_header *cdrom_sysctl_header;
@@ -722,13 +722,12 @@ static int hpet_is_known(struct hpet_data *hdp)
static struct ctl_table hpet_table[] = {
{
- .procname = "max-user-freq",
- .data = &hpet_max_freq,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec,
- },
- {}
+ .procname = "max-user-freq",
+ .data = &hpet_max_freq,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ }
};
static struct ctl_table_header *sysctl_header;
@@ -655,8 +655,7 @@ static struct ctl_table ipmi_table[] = {
.data = &poweroff_powercycle,
.maxlen = sizeof(poweroff_powercycle),
.mode = 0644,
- .proc_handler = proc_dointvec },
- { }
+ .proc_handler = proc_dointvec }
};
static struct ctl_table_header *ipmi_table_header;
@@ -1682,8 +1682,7 @@ static struct ctl_table random_table[] = {
.procname = "uuid",
.mode = 0444,
.proc_handler = proc_do_uuid,
- },
- { }
+ }
};
/*
@@ -4884,24 +4884,23 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
static struct ctl_table oa_table[] = {
{
- .procname = "perf_stream_paranoid",
- .data = &i915_perf_stream_paranoid,
- .maxlen = sizeof(i915_perf_stream_paranoid),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
- },
+ .procname = "perf_stream_paranoid",
+ .data = &i915_perf_stream_paranoid,
+ .maxlen = sizeof(i915_perf_stream_paranoid),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
{
- .procname = "oa_max_sample_rate",
- .data = &i915_oa_max_sample_rate,
- .maxlen = sizeof(i915_oa_max_sample_rate),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = &oa_sample_rate_hard_limit,
- },
- {}
+ .procname = "oa_max_sample_rate",
+ .data = &i915_oa_max_sample_rate,
+ .maxlen = sizeof(i915_oa_max_sample_rate),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = &oa_sample_rate_hard_limit,
+ }
};
static u32 num_perf_groups_per_gt(struct intel_gt *gt)
@@ -146,8 +146,7 @@ static struct ctl_table hv_ctl_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE
- },
- {}
+ }
};
static int hv_die_panic_notify_crash(struct notifier_block *self,
@@ -110,8 +110,7 @@ static struct ctl_table iwcm_ctl_table[] = {
.maxlen = sizeof(default_backlog),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
/*
@@ -70,8 +70,7 @@ static struct ctl_table ucma_ctl_table[] = {
.maxlen = sizeof max_backlog,
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
struct ucma_file {
@@ -235,8 +235,7 @@ static struct ctl_table mac_hid_files[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static struct ctl_table_header *mac_hid_sysctl_header;
@@ -318,8 +318,7 @@ static struct ctl_table raid_table[] = {
.maxlen = sizeof(int),
.mode = S_IRUGO|S_IWUSR,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static int start_readonly;
@@ -109,8 +109,7 @@ static struct ctl_table xpc_sys_xpc_hb[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &xpc_hb_check_min_interval,
- .extra2 = &xpc_hb_check_max_interval},
- {}
+ .extra2 = &xpc_hb_check_max_interval}
};
static struct ctl_table xpc_sys_xpc[] = {
{
@@ -120,8 +119,7 @@ static struct ctl_table xpc_sys_xpc[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &xpc_disengage_min_timelimit,
- .extra2 = &xpc_disengage_max_timelimit},
- {}
+ .extra2 = &xpc_disengage_max_timelimit}
};
static struct ctl_table_header *xpc_sysctl;
@@ -1964,8 +1964,7 @@ static const struct ctl_table vrf_table[] = {
.proc_handler = vrf_shared_table_handler,
/* set by the vrf_netns_init */
.extra1 = NULL,
- },
- { },
+ }
};
static int vrf_netns_init_sysctl(struct net *net, struct netns_vrf *nn_vrf)
@@ -259,8 +259,12 @@ PARPORT_MAX_SPINTIME_VALUE;
struct parport_sysctl_table {
struct ctl_table_header *port_header;
struct ctl_table_header *devices_header;
- struct ctl_table vars[12];
- struct ctl_table device_dir[2];
+#ifdef CONFIG_PARPORT_1284
+ struct ctl_table vars[10];
+#else
+ struct ctl_table vars[5];
+#endif /* IEEE 1284 support */
+ struct ctl_table device_dir[1];
};
static const struct parport_sysctl_table parport_sysctl_template = {
@@ -303,9 +307,9 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.maxlen = 0,
.mode = 0444,
.proc_handler = do_hardware_modes
- },
+ }
#ifdef CONFIG_PARPORT_1284
- {
+ , {
.procname = "autoprobe",
.data = NULL,
.maxlen = 0,
@@ -339,9 +343,8 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.maxlen = 0,
.mode = 0444,
.proc_handler = do_autoprobe
- },
+ }
#endif /* IEEE 1284 support */
- {}
},
{
{
@@ -350,20 +353,15 @@ static const struct parport_sysctl_table parport_sysctl_template = {
.maxlen = 0,
.mode = 0444,
.proc_handler = do_active_device
- },
- {}
+ }
},
};
struct parport_device_sysctl_table
{
struct ctl_table_header *sysctl_header;
- struct ctl_table vars[2];
- struct ctl_table device_dir[2];
- struct ctl_table devices_root_dir[2];
- struct ctl_table port_dir[2];
- struct ctl_table parport_dir[2];
- struct ctl_table dev_dir[2];
+ struct ctl_table vars[1];
+ struct ctl_table device_dir[1];
};
static const struct parport_device_sysctl_table
@@ -378,8 +376,7 @@ parport_device_sysctl_template = {
.proc_handler = proc_doulongvec_ms_jiffies_minmax,
.extra1 = (void*) &parport_min_timeslice_value,
.extra2 = (void*) &parport_max_timeslice_value
- },
- {}
+ }
},
{
{
@@ -387,18 +384,14 @@ parport_device_sysctl_template = {
.data = NULL,
.maxlen = 0,
.mode = 0555,
- },
- {}
+ }
}
};
struct parport_default_sysctl_table
{
struct ctl_table_header *sysctl_header;
- struct ctl_table vars[3];
- struct ctl_table default_dir[2];
- struct ctl_table parport_dir[2];
- struct ctl_table dev_dir[2];
+ struct ctl_table vars[2];
};
static struct parport_default_sysctl_table
@@ -422,8 +415,7 @@ parport_default_sysctl_table = {
.proc_handler = proc_dointvec_minmax,
.extra1 = (void*) &parport_min_spintime_value,
.extra2 = (void*) &parport_max_spintime_value
- },
- {}
+ }
}
};
@@ -443,7 +435,9 @@ int parport_proc_register(struct parport *port)
t->vars[0].data = &port->spintime;
for (i = 0; i < 5; i++) {
t->vars[i].extra1 = port;
+#ifdef CONFIG_PARPORT_1284
t->vars[5 + i].extra2 = &port->probe_info[i];
+#endif /* IEEE 1284 support */
}
port_name_len = strnlen(port->name, PARPORT_NAME_MAX_LEN);
@@ -1179,8 +1179,7 @@ static struct ctl_table armv8_pmu_sysctl_table[] = {
.proc_handler = armv8pmu_proc_user_access_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static void armv8_pmu_register_sysctl_table(void)
@@ -17,8 +17,7 @@ static struct ctl_table scsi_table[] = {
.data = &scsi_logging_level,
.maxlen = sizeof(scsi_logging_level),
.mode = 0644,
- .proc_handler = proc_dointvec },
- { }
+ .proc_handler = proc_dointvec }
};
static struct ctl_table_header *scsi_table_header;
@@ -1638,8 +1638,7 @@ static struct ctl_table sg_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
- },
- {}
+ }
};
static struct ctl_table_header *hdr;
@@ -3608,8 +3608,7 @@ static struct ctl_table tty_table[] = {
.proc_handler = proc_dointvec,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
/*
@@ -93,8 +93,7 @@ static struct ctl_table balloon_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
#else
@@ -238,8 +238,7 @@ static struct ctl_table aio_sysctls[] = {
.maxlen = sizeof(aio_max_nr),
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
- },
- {}
+ }
};
static void __init aio_sysctl_init(void)
@@ -18,8 +18,7 @@ static struct ctl_table cachefiles_sysctls[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_douintvec,
- },
- {}
+ }
};
int __init cachefiles_register_error_injection(void)
@@ -35,8 +35,7 @@ static struct ctl_table coda_table[] = {
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = proc_dointvec
- },
- {}
+ }
};
void coda_sysctl_init(void)
@@ -978,8 +978,7 @@ static struct ctl_table coredump_sysctls[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static int __init init_fs_coredump_sysctls(void)
@@ -190,8 +190,7 @@ static struct ctl_table fs_dcache_sysctls[] = {
.maxlen = 6*sizeof(long),
.mode = 0444,
.proc_handler = proc_nr_dentry,
- },
- { }
+ }
};
static int __init init_fs_dcache_sysctls(void)
@@ -68,8 +68,7 @@ static struct ctl_table pty_table[] = {
.mode = 0444,
.data = &pty_count,
.proc_handler = proc_dointvec,
- },
- {}
+ }
};
struct pts_mount_opts {
@@ -321,8 +321,7 @@ static struct ctl_table epoll_table[] = {
.proc_handler = proc_doulongvec_minmax,
.extra1 = &long_zero,
.extra2 = &long_max,
- },
- { }
+ }
};
static void __init epoll_sysctls_init(void)
@@ -2164,8 +2164,7 @@ static struct ctl_table fs_exec_sysctls[] = {
.proc_handler = proc_dointvec_minmax_coredump,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
- },
- { }
+ }
};
static int __init init_fs_exec_sysctls(void)
@@ -114,8 +114,7 @@ static struct ctl_table fs_stat_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &sysctl_nr_open_min,
.extra2 = &sysctl_nr_open_max,
- },
- { }
+ }
};
static int __init init_fs_stat_sysctls(void)
@@ -129,8 +129,7 @@ static struct ctl_table inodes_sysctls[] = {
.maxlen = 7*sizeof(long),
.mode = 0444,
.proc_handler = proc_nr_inodes,
- },
- { }
+ }
};
static int __init init_fs_inode_sysctls(void)
@@ -506,8 +506,7 @@ static struct ctl_table nlm_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
#endif /* CONFIG_SYSCTL */
@@ -109,9 +109,8 @@ static struct ctl_table locks_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
+ }
#endif /* CONFIG_MMU */
- {}
};
static int __init init_fs_locks_sysctls(void)
@@ -1067,8 +1067,7 @@ static struct ctl_table namei_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
- },
- { }
+ }
};
static int __init init_fs_namei_sysctls(void)
@@ -4709,8 +4709,7 @@ static struct ctl_table fs_namespace_sysctls[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init init_fs_namespace_sysctls(void)
@@ -33,8 +33,7 @@ static struct ctl_table nfs4_cb_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
int nfs4_register_sysctl(void)
@@ -28,8 +28,7 @@ static struct ctl_table nfs_cb_sysctls[] = {
.maxlen = sizeof(nfs_congestion_kb),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
int nfs_register_sysctl(void)
@@ -28,8 +28,7 @@ static struct ctl_table dnotify_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- {}
+ }
};
static void __init dnotify_sysctl_init(void)
{
@@ -85,8 +85,7 @@ static struct ctl_table fanotify_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO
- },
- { }
+ }
};
static void __init fanotify_sysctls_init(void)
@@ -84,8 +84,7 @@ static struct ctl_table inotify_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO
- },
- { }
+ }
};
static void __init inotify_sysctls_init(void)
@@ -27,8 +27,7 @@ static struct ctl_table ntfs_sysctls[] = {
.maxlen = sizeof(debug_msgs),
.mode = 0644, /* Mode, proc handler. */
.proc_handler = proc_dointvec
- },
- {}
+ }
};
/* Storage for the sysctls header. */
@@ -657,8 +657,7 @@ static struct ctl_table ocfs2_nm_table[] = {
.maxlen = OCFS2_MAX_HB_CTL_PATH,
.mode = 0644,
.proc_handler = proc_dostring,
- },
- { }
+ }
};
static struct ctl_table_header *ocfs2_table_header;
@@ -1491,8 +1491,7 @@ static struct ctl_table fs_pipe_sysctls[] = {
.maxlen = sizeof(pipe_user_pages_soft),
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
- },
- { }
+ }
};
#endif
@@ -19,8 +19,9 @@
#include <linux/kmemleak.h>
#include "internal.h"
-#define list_for_each_table_entry(entry, header) \
- for ((entry) = (header->ctl_table); (entry)->procname; (entry)++)
+#define list_for_each_table_entry(entry, header) \
+ entry = header->ctl_table; \
+ for (size_t i = 0 ; i < header->ctl_table_size ; ++i, entry++)
static const struct dentry_operations proc_sys_dentry_operations;
static const struct file_operations proc_sys_file_operations;
@@ -69,8 +70,7 @@ static struct ctl_table root_table[] = {
{
.procname = "",
.mode = S_IFDIR|S_IRUGO|S_IXUGO,
- },
- { }
+ }
};
static struct ctl_table_root sysctl_table_root = {
.default_set.dir.header = {
@@ -2941,9 +2941,8 @@ static struct ctl_table fs_dqstats_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
+ }
#endif
- { },
};
static int __init dquot_init(void)
@@ -25,8 +25,7 @@ static struct ctl_table fs_shared_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_MAXOLDUID,
- },
- { }
+ }
};
static int __init init_fs_sysctls(void)
@@ -44,8 +44,7 @@ static struct ctl_table vm_userfaultfd_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
#endif
@@ -97,8 +97,7 @@ static struct ctl_table fsverity_sysctl_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init fsverity_sysctl_init(void)
@@ -204,10 +204,8 @@ static struct ctl_table xfs_table[] = {
.proc_handler = xfs_stats_clear_proc_handler,
.extra1 = &xfs_params.stats_clear.min,
.extra2 = &xfs_params.stats_clear.max
- },
+ }
#endif /* CONFIG_PROC_FS */
-
- {}
};
int
@@ -28,8 +28,7 @@ static struct ctl_table kern_do_mounts_initrd_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static __init int kernel_do_mounts_initrd_sysctls_init(void)
@@ -175,9 +175,8 @@ static struct ctl_table ipc_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
- },
+ }
#endif
- {}
};
static struct ctl_table_set *set_lookup(struct ctl_table_root *root)
@@ -62,8 +62,7 @@ static struct ctl_table mq_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &msg_maxsize_limit_min,
.extra2 = &msg_maxsize_limit_max,
- },
- {}
+ }
};
static struct ctl_table_set *set_lookup(struct ctl_table_root *root)
@@ -83,8 +83,7 @@ static struct ctl_table kern_acct_table[] = {
.maxlen = 3*sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static __init int kernel_acct_sysctls_init(void)
@@ -5400,8 +5400,7 @@ static struct ctl_table bpf_syscall_table[] = {
.data = &bpf_stats_enabled_key.key,
.mode = 0644,
.proc_handler = bpf_stats_handler,
- },
- { }
+ }
};
static int __init bpf_syscall_sysctl_init(void)
@@ -73,8 +73,7 @@ static struct ctl_table kern_delayacct_table[] = {
.proc_handler = sysctl_delayacct,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static __init int kernel_delayacct_sysctls_init(void)
@@ -89,8 +89,7 @@ static struct ctl_table kern_exit_table[] = {
.maxlen = sizeof(oops_limit),
.mode = 0644,
.proc_handler = proc_douintvec,
- },
- { }
+ }
};
static __init int kernel_exit_sysctls_init(void)
@@ -312,8 +312,7 @@ static struct ctl_table hung_task_sysctls[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_NEG_ONE,
- },
- {}
+ }
};
static void __init hung_task_sysctl_init(void)
@@ -1001,8 +1001,7 @@ static struct ctl_table kexec_core_sysctls[] = {
.data = &load_limit_reboot,
.mode = 0644,
.proc_handler = kexec_limit_handler,
- },
- { }
+ }
};
static int __init kexec_core_sysctl_init(void)
@@ -967,8 +967,7 @@ static struct ctl_table kprobe_sysctls[] = {
.proc_handler = proc_kprobes_optimization_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static void __init kprobe_sysctls_init(void)
@@ -84,8 +84,7 @@ static struct ctl_table latencytop_sysctl[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = sysctl_latencytop,
- },
- {}
+ }
};
#endif
@@ -95,9 +95,8 @@ static struct ctl_table kern_lockdep_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
+ }
#endif /* CONFIG_LOCK_STAT */
- { }
};
static __init int kernel_lockdep_sysctls_init(void)
@@ -98,8 +98,7 @@ static struct ctl_table kern_panic_table[] = {
.maxlen = sizeof(warn_limit),
.mode = 0644,
.proc_handler = proc_douintvec,
- },
- { }
+ }
};
static __init int kernel_panic_sysctls_init(void)
@@ -311,8 +311,7 @@ static struct ctl_table pid_ns_ctl_table[] = {
.proc_handler = pid_ns_ctl_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = &pid_max,
- },
- { }
+ }
};
#endif /* CONFIG_CHECKPOINT_RESTORE */
@@ -43,8 +43,7 @@ static struct ctl_table pid_ns_ctl_table_vm[] = {
.proc_handler = pid_mfd_noexec_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
- },
- { }
+ }
};
static inline void register_pid_ns_sysctl_table_vm(void)
{
@@ -75,8 +75,7 @@ static struct ctl_table printk_sysctls[] = {
.proc_handler = proc_dointvec_minmax_sysadmin,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
- },
- {}
+ }
};
void __init printk_sysctl_init(void)
@@ -1271,8 +1271,7 @@ static struct ctl_table kern_reboot_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static void __init kernel_reboot_sysctls_init(void)
@@ -18,8 +18,7 @@ static struct ctl_table sched_autogroup_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static void __init sched_autogroup_sysctl_init(void)
@@ -4671,9 +4671,8 @@ static struct ctl_table sched_core_sysctls[] = {
.proc_handler = sysctl_numa_balancing,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_FOUR,
- },
+ }
#endif /* CONFIG_NUMA_BALANCING */
- {}
};
static int __init sched_core_sysctl_init(void)
{
@@ -40,8 +40,7 @@ static struct ctl_table sched_dl_sysctls[] = {
.mode = 0644,
.proc_handler = proc_douintvec_minmax,
.extra2 = (void *)&sysctl_sched_dl_period_max,
- },
- {}
+ }
};
static int __init sched_dl_sysctl_init(void)
@@ -210,9 +210,8 @@ static struct ctl_table sched_fair_sysctls[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
- },
+ }
#endif /* CONFIG_NUMA_BALANCING */
- {}
};
static int __init sched_fair_sysctl_init(void)
@@ -51,8 +51,7 @@ static struct ctl_table sched_rt_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = sched_rr_handler,
- },
- {}
+ }
};
static int __init sched_rt_sysctl_init(void)
@@ -249,8 +249,7 @@ static struct ctl_table sched_energy_aware_sysctls[] = {
.proc_handler = sched_energy_aware_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static int __init sched_energy_aware_sysctl_init(void)
@@ -2380,8 +2380,7 @@ static struct ctl_table seccomp_sysctl_table[] = {
.procname = "actions_logged",
.mode = 0644,
.proc_handler = seccomp_actions_logged_handler,
- },
- { }
+ }
};
static int __init seccomp_sysctl_init(void)
@@ -4781,9 +4781,8 @@ static struct ctl_table signal_debug_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
- },
+ }
#endif
- { }
};
static int __init init_signal_sysctls(void)
@@ -53,8 +53,7 @@ static struct ctl_table stackleak_sysctls[] = {
.proc_handler = stack_erasing_sysctl,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static int __init stackleak_sysctls_init(void)
@@ -2041,9 +2041,8 @@ static struct ctl_table kern_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_INT_MAX,
- },
+ }
#endif
- { }
};
static struct ctl_table vm_table[] = {
@@ -2314,9 +2313,8 @@ static struct ctl_table vm_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = (void *)&mmap_rnd_compat_bits_min,
.extra2 = (void *)&mmap_rnd_compat_bits_max,
- },
+ }
#endif
- { }
};
int __init sysctl_init_bases(void)
@@ -259,8 +259,7 @@ static struct ctl_table timer_sysctl[] = {
.proc_handler = timer_migration_handler,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- {}
+ }
};
static int __init timer_sysctl_init(void)
@@ -8213,8 +8213,7 @@ static struct ctl_table ftrace_sysctls[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = ftrace_enable_sysctl,
- },
- {}
+ }
};
static int __init ftrace_sysctl_init(void)
@@ -2530,8 +2530,7 @@ static struct ctl_table user_event_sysctls[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = set_max_user_events_sysctl,
- },
- {}
+ }
};
static int __init trace_events_user_init(void)
@@ -85,10 +85,9 @@ static struct ctl_table user_table[] = {
#endif
#ifdef CONFIG_FANOTIFY
UCOUNT_ENTRY("max_fanotify_groups"),
- UCOUNT_ENTRY("max_fanotify_marks"),
+ UCOUNT_ENTRY("max_fanotify_marks")
#endif
- { }
-};
+ };
#endif /* CONFIG_SYSCTL */
bool setup_userns_sysctls(struct user_namespace *ns)
@@ -96,7 +95,7 @@ bool setup_userns_sysctls(struct user_namespace *ns)
#ifdef CONFIG_SYSCTL
struct ctl_table *tbl;
- BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
+ BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS);
setup_sysctl_set(&ns->set, &set_root, set_is_seen);
tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
if (tbl) {
@@ -559,8 +559,7 @@ static struct ctl_table usermodehelper_table[] = {
.maxlen = 2 * sizeof(unsigned long),
.mode = 0600,
.proc_handler = proc_cap_handler,
- },
- { }
+ }
};
static int __init init_umh_sysctls(void)
@@ -119,8 +119,7 @@ static struct ctl_table uts_kern_table[] = {
.mode = 0644,
.proc_handler = proc_do_uts_string,
.poll = &domainname_poll,
- },
- {}
+ }
};
#ifdef CONFIG_PROC_SYSCTL
@@ -839,10 +839,9 @@ static struct ctl_table watchdog_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
+ }
#endif /* CONFIG_SMP */
#endif
- {}
};
static void __init watchdog_sysctl_init(void)
@@ -129,8 +129,7 @@ static struct ctl_table test_table[] = {
.maxlen = SYSCTL_TEST_BITMAP_SIZE,
.mode = 0644,
.proc_handler = proc_do_large_bitmap,
- },
- { }
+ }
};
static void test_sysctl_calc_match_int_ok(void)
@@ -184,8 +183,7 @@ static struct ctl_table test_table_unregister[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- },
- {}
+ }
};
static int test_sysctl_run_unregister_nested(void)
@@ -3126,8 +3126,7 @@ static struct ctl_table vm_compaction[] = {
.proc_handler = proc_dointvec_minmax_warn_RT_change,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init kcompactd_init(void)
@@ -4675,8 +4675,7 @@ static struct ctl_table hugetlb_table[] = {
.maxlen = sizeof(unsigned long),
.mode = 0644,
.proc_handler = hugetlb_overcommit_handler,
- },
- { }
+ }
};
static void hugetlb_sysctl_init(void)
@@ -584,8 +584,7 @@ static struct ctl_table hugetlb_vmemmap_sysctls[] = {
.maxlen = sizeof(vmemmap_optimize_enabled),
.mode = 0644,
.proc_handler = proc_dobool,
- },
- { }
+ }
};
static int __init hugetlb_vmemmap_init(void)
@@ -142,8 +142,7 @@ static struct ctl_table memory_failure_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static int __init memory_failure_sysctl_init(void)
@@ -725,8 +725,7 @@ static struct ctl_table vm_oom_kill_table[] = {
.maxlen = sizeof(sysctl_oom_dump_tasks),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- {}
+ }
};
#endif
@@ -2290,8 +2290,7 @@ static struct ctl_table vm_page_writeback_sysctls[] = {
.maxlen = sizeof(laptop_mode),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- {}
+ }
};
#endif
@@ -39,8 +39,7 @@ static struct ctl_table atalk_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { },
+ }
};
static struct ctl_table_header *atalk_table_header;
@@ -139,10 +139,9 @@ static const struct ctl_table ax25_param_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_ds_timeout,
.extra2 = &max_ds_timeout
- },
+ }
#endif
-
- { } /* that's all, folks! */
+/* that's all, folks! */
};
int ax25_register_dev_sysctl(ax25_dev *ax25_dev)
@@ -1100,8 +1100,7 @@ static struct ctl_table brnf_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = brnf_sysctl_call_tables,
- },
- { }
+ }
};
static inline void br_netfilter_sysctl_default(struct brnf_net *brnf)
@@ -3716,7 +3716,7 @@ static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,
static struct neigh_sysctl_table {
struct ctl_table_header *sysctl_header;
- struct ctl_table neigh_vars[NEIGH_VAR_MAX + 1];
+ struct ctl_table neigh_vars[NEIGH_VAR_MAX];
} neigh_sysctl_template __read_mostly = {
.neigh_vars = {
NEIGH_SYSCTL_ZERO_INTMAX_ENTRY(MCAST_PROBES, "mcast_solicit"),
@@ -3766,9 +3766,8 @@ static struct neigh_sysctl_table {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_INT_MAX,
.proc_handler = proc_dointvec_minmax,
- },
- {},
- },
+ }
+ }
};
int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
@@ -3779,6 +3778,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
const char *dev_name_source;
char neigh_path[ sizeof("net//neigh/") + IFNAMSIZ + IFNAMSIZ ];
char *p_name;
+ size_t neigh_vars_size;
t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL_ACCOUNT);
if (!t)
@@ -3790,11 +3790,11 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
t->neigh_vars[i].extra2 = p;
}
+ neigh_vars_size = ARRAY_SIZE(t->neigh_vars);
if (dev) {
dev_name_source = dev->name;
/* Terminate the table early */
- memset(&t->neigh_vars[NEIGH_VAR_GC_INTERVAL], 0,
- sizeof(t->neigh_vars[NEIGH_VAR_GC_INTERVAL]));
+ neigh_vars_size = NEIGH_VAR_BASE_REACHABLE_TIME_MS;
} else {
struct neigh_table *tbl = p->tbl;
dev_name_source = "default";
@@ -3843,7 +3843,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
p_name, dev_name_source);
t->sysctl_header =
register_net_sysctl(neigh_parms_net(p), neigh_path, t->neigh_vars,
- ARRAY_SIZE(t->neigh_vars));
+ neigh_vars_size);
if (!t->sysctl_header)
goto free;
@@ -652,8 +652,7 @@ static struct ctl_table net_core_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
- },
- { }
+ }
};
static struct ctl_table netns_core_table[] = {
@@ -681,8 +680,7 @@ static struct ctl_table netns_core_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
.proc_handler = proc_dou8vec_minmax,
- },
- { }
+ }
};
static int __init fb_tunnels_only_for_init_net_sysctl_setup(char *str)
@@ -89,9 +89,7 @@ static struct ctl_table dccp_default_table[] = {
.maxlen = sizeof(sysctl_dccp_sync_ratelimit),
.mode = 0644,
.proc_handler = proc_dointvec_ms_jiffies,
- },
-
- { }
+ }
};
static struct ctl_table_header *dccp_table_header;
@@ -337,8 +337,7 @@ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
/* secret interval has been deprecated */
@@ -350,8 +349,7 @@ static struct ctl_table lowpan_frags_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
@@ -2516,7 +2516,7 @@ static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,
static struct devinet_sysctl_table {
struct ctl_table_header *sysctl_header;
- struct ctl_table devinet_vars[__IPV4_DEVCONF_MAX];
+ struct ctl_table devinet_vars[IPV4_DEVCONF_MAX];
} devinet_sysctl = {
.devinet_vars = {
DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding",
@@ -2653,8 +2653,7 @@ static struct ctl_table ctl_forward_entry[] = {
.proc_handler = devinet_sysctl_forward,
.extra1 = &ipv4_devconf,
.extra2 = &init_net,
- },
- { },
+ }
};
#endif
@@ -579,8 +579,7 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &dist_min,
- },
- { }
+ }
};
/* secret interval has been deprecated */
@@ -592,8 +591,7 @@ static struct ctl_table ip4_frags_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
static int __net_init ip4_frags_ns_ctl_register(struct net *net)
@@ -3551,8 +3551,7 @@ static struct ctl_table ipv4_route_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static const char ipv4_route_flush_procname[] = "flush";
@@ -3585,8 +3584,7 @@ static struct ctl_table ipv4_route_netns_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { },
+ }
};
static __net_init int sysctl_route_net_init(struct net *net)
@@ -577,8 +577,7 @@ static struct ctl_table ipv4_table[] = {
.proc_handler = proc_douintvec_minmax,
.extra1 = &sysctl_fib_sync_mem_min,
.extra2 = &sysctl_fib_sync_mem_max,
- },
- { }
+ }
};
static struct ctl_table ipv4_net_table[] = {
@@ -1469,8 +1468,7 @@ static struct ctl_table ipv4_net_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &tcp_plb_max_cong_thresh,
- },
- { }
+ }
};
static __net_init int ipv4_sysctl_init_net(struct net *net)
@@ -160,8 +160,7 @@ static struct ctl_table xfrm4_policy_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static __net_init int xfrm4_net_sysctl_init(struct net *net)
@@ -7055,9 +7055,6 @@ static const struct ctl_table addrconf_sysctl[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO,
- },
- {
- /* sentinel */
}
};
@@ -7072,7 +7069,7 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
if (!table)
goto out;
- for (i = 0; table[i].data; i++) {
+ for (i = 0; i < ARRAY_SIZE(addrconf_sysctl); i++) {
table[i].data += (char *)p - (char *)&ipv6_devconf;
/* If one of these is already set, then it is not safe to
* overwrite either of them: this makes proc_dointvec_minmax
@@ -1204,8 +1204,7 @@ static struct ctl_table ipv6_icmp_table_template[] = {
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { },
+ }
};
struct ctl_table * __net_init ipv6_icmp_sysctl_init(struct net *net)
@@ -61,8 +61,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = {
.maxlen = sizeof(unsigned long),
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
- },
- { }
+ }
};
static int nf_ct_frag6_sysctl_register(struct net *net)
@@ -435,8 +435,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
/* secret interval has been deprecated */
@@ -448,8 +447,7 @@ static struct ctl_table ip6_frags_ctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
@@ -6417,8 +6417,7 @@ static struct ctl_table ipv6_route_table_template[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
@@ -212,8 +212,7 @@ static struct ctl_table ipv6_table_template[] = {
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
.extra2 = &ioam6_id_wide_max,
- },
- { }
+ }
};
static struct ctl_table ipv6_rotable[] = {
@@ -246,9 +245,8 @@ static struct ctl_table ipv6_rotable[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
+ }
#endif /* CONFIG_NETLABEL */
- { }
};
static int __net_init ipv6_sysctl_net_init(struct net *net)
@@ -187,8 +187,7 @@ static struct ctl_table xfrm6_policy_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static int __net_init xfrm6_net_sysctl_init(struct net *net)
@@ -43,12 +43,10 @@ static struct ctl_table llc2_timeout_table[] = {
.maxlen = sizeof(sysctl_llc2_rej_timeout),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { },
+ }
};
static struct ctl_table llc_station_table[] = {
- { },
};
static struct ctl_table_header *llc2_timeout_header;
@@ -1391,8 +1391,7 @@ static const struct ctl_table mpls_dev_table[] = {
.mode = 0644,
.proc_handler = mpls_conf_proc,
.data = MPLS_PERDEV_SYSCTL_OFFSET(input_enabled),
- },
- { }
+ }
};
static int mpls_platform_labels(struct ctl_table *table, int write,
@@ -1425,8 +1424,7 @@ static const struct ctl_table mpls_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = &ttl_max,
- },
- { }
+ }
};
static int mpls_dev_sysctl_register(struct net_device *dev,
@@ -1444,7 +1442,7 @@ static int mpls_dev_sysctl_register(struct net_device *dev,
/* Table data contains only offsets relative to the base of
* the mdev at this point, so make them absolute.
*/
- for (i = 0; i < ARRAY_SIZE(mpls_dev_table) - 1; i++) {
+ for (i = 0; i < ARRAY_SIZE(mpls_dev_table); i++) {
table[i].data = (char *)mdev + (uintptr_t)table[i].data;
table[i].extra1 = mdev;
table[i].extra2 = net;
@@ -2689,7 +2687,7 @@ static int mpls_net_init(struct net *net)
/* Table data contains only offsets relative to the base of
* the mdev at this point, so make them absolute.
*/
- for (i = 0; i < ARRAY_SIZE(mpls_table) - 1; i++)
+ for (i = 0; i < ARRAY_SIZE(mpls_table); i++)
table[i].data = (char *)net + (uintptr_t)table[i].data;
net->mpls.ctl = register_net_sysctl(net, "net/mpls", table,
@@ -127,8 +127,7 @@ static struct ctl_table mptcp_sysctl_table[] = {
.proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &mptcp_pm_type_max
- },
- {}
+ }
};
static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
@@ -2258,9 +2258,8 @@ static struct ctl_table vs_vars[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
+ }
#endif
- { }
};
#endif
@@ -122,8 +122,7 @@ static struct ctl_table vs_vars_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
#endif
@@ -293,8 +293,7 @@ static struct ctl_table vs_vars_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { }
+ }
};
#endif
@@ -616,11 +616,9 @@ enum nf_ct_sysctl_index {
NF_SYSCTL_CT_LWTUNNEL,
#endif
- __NF_SYSCTL_CT_LAST_SYSCTL,
+ NF_SYSCTL_CT_LAST_SYSCTL,
};
-#define NF_SYSCTL_CT_LAST_SYSCTL (__NF_SYSCTL_CT_LAST_SYSCTL + 1)
-
static struct ctl_table nf_ct_sysctl_table[] = {
[NF_SYSCTL_CT_MAX] = {
.procname = "nf_conntrack_max",
@@ -955,9 +953,8 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = nf_hooks_lwtunnel_sysctl_handler,
- },
+ }
#endif
- {}
};
static struct ctl_table nf_ct_netfilter_table[] = {
@@ -967,8 +964,7 @@ static struct ctl_table nf_ct_netfilter_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static void nf_conntrack_standalone_init_tcp_sysctl(struct net *net,
@@ -389,7 +389,7 @@ static const struct seq_operations nflog_seq_ops = {
#ifdef CONFIG_SYSCTL
static char nf_log_sysctl_fnames[NFPROTO_NUMPROTO-NFPROTO_UNSPEC][3];
-static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1];
+static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO];
static struct ctl_table_header *nf_log_sysctl_fhdr;
static struct ctl_table nf_log_sysctl_ftable[] = {
@@ -399,8 +399,7 @@ static struct ctl_table nf_log_sysctl_ftable[] = {
.maxlen = sizeof(sysctl_nf_log_all_netns),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
static int nf_log_proc_dostring(struct ctl_table *table, int write,
@@ -139,8 +139,7 @@ static struct ctl_table nr_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_reset,
.extra2 = &max_reset
- },
- { }
+ }
};
int __init nr_register_sysctl(void)
@@ -80,8 +80,7 @@ static struct ctl_table phonet_table[] = {
.maxlen = sizeof(local_port_range),
.mode = 0644,
.proc_handler = proc_local_port_range,
- },
- { }
+ }
};
int __init phonet_sysctl_init(void)
@@ -102,8 +102,7 @@ static struct ctl_table rds_ib_sysctl_table[] = {
.maxlen = sizeof(rds_ib_sysctl_flow_control),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
void rds_ib_sysctl_exit(void)
@@ -88,8 +88,7 @@ static struct ctl_table rds_sysctl_rds_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
void rds_sysctl_exit(void)
@@ -85,8 +85,7 @@ static struct ctl_table rds_tcp_sysctl_table[] = {
.mode = 0644,
.proc_handler = rds_tcp_skbuf_handler,
.extra1 = &rds_tcp_min_rcvbuf,
- },
- { }
+ }
};
u32 rds_tcp_write_seq(struct rds_tcp_connection *tc)
@@ -111,8 +111,7 @@ static struct ctl_table rose_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_window,
.extra2 = &max_window
- },
- { }
+ }
};
void __init rose_register_sysctl(void)
@@ -124,8 +124,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = (void *)SYSCTL_ONE,
.extra2 = (void *)&four,
- },
- { }
+ }
};
int __init rxrpc_sysctl_init(void)
@@ -79,9 +79,7 @@ static struct ctl_table sctp_table[] = {
.maxlen = sizeof(sysctl_sctp_wmem),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
-
- { /* sentinel */ }
+ }
};
/* The following index defines are used in sctp_sysctl_net_register().
@@ -383,9 +381,7 @@ static struct ctl_table sctp_net_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &pf_expose_max,
- },
-
- { /* sentinel */ }
+ }
};
static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
@@ -604,7 +600,7 @@ int sctp_sysctl_net_register(struct net *net)
if (!table)
return -ENOMEM;
- for (i = 0; table[i].data; i++)
+ for (i = 0; i < ARRAY_SIZE(sctp_net_table); i++)
table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
table[SCTP_RTO_MIN_IDX].extra2 = &net->sctp.rto_max;
@@ -61,8 +61,7 @@ static struct ctl_table smc_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_rcvbuf,
- },
- { }
+ }
};
int __net_init smc_sysctl_net_init(struct net *net)
@@ -159,8 +159,7 @@ static struct ctl_table debug_table[] = {
.maxlen = 256,
.mode = 0444,
.proc_handler = proc_do_xprt,
- },
- { }
+ }
};
void
@@ -208,8 +208,7 @@ static struct ctl_table svcrdma_parm_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &zero,
- },
- { },
+ }
};
static void svc_rdma_proc_cleanup(void)
@@ -136,8 +136,7 @@ static struct ctl_table xr_tunables_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { },
+ }
};
#endif
@@ -154,8 +154,7 @@ static struct ctl_table xs_tunables_table[] = {
.maxlen = sizeof(xs_tcp_fin_timeout),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
- },
- { },
+ }
};
/*
@@ -90,8 +90,7 @@ static struct ctl_table tipc_table[] = {
.maxlen = sizeof(sysctl_tipc_bc_retruni),
.mode = 0644,
.proc_handler = proc_doulongvec_minmax,
- },
- {}
+ }
};
int tipc_register_sysctl(void)
@@ -18,8 +18,7 @@ static struct ctl_table unix_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
- },
- { }
+ }
};
int __net_init unix_sysctl_register(struct net *net)
@@ -70,8 +70,7 @@ static struct ctl_table x25_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { },
+ }
};
int __init x25_register_sysctl(void)
@@ -37,8 +37,7 @@ static struct ctl_table xfrm_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
- },
- {}
+ }
};
int __net_init xfrm_sysctl_init(struct net *net)
@@ -1778,9 +1778,7 @@ static struct ctl_table apparmor_sysctl_table[] = {
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = apparmor_dointvec,
- },
-
- { }
+ }
};
static int __init apparmor_init_sysctl(void)
@@ -54,9 +54,9 @@ struct ctl_table key_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = (void *) SYSCTL_ZERO,
.extra2 = (void *) SYSCTL_INT_MAX,
- },
+ }
#ifdef CONFIG_PERSISTENT_KEYRINGS
- {
+ , {
.procname = "persistent_keyring_expiry",
.data = &persistent_keyring_expiry,
.maxlen = sizeof(unsigned),
@@ -64,9 +64,8 @@ struct ctl_table key_sysctls[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = (void *) SYSCTL_ZERO,
.extra2 = (void *) SYSCTL_INT_MAX,
- },
+ }
#endif
- { }
};
static int __init init_security_keys_sysctls(void)
@@ -61,8 +61,7 @@ static struct ctl_table loadpin_sysctl_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_ONE,
- },
- { }
+ }
};
static void set_sysctl(bool is_writable)
@@ -456,8 +456,7 @@ static struct ctl_table yama_sysctl_table[] = {
.proc_handler = yama_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &max_scope,
- },
- { }
+ }
};
static void __init yama_init_sysctl(void)
{
Remove the empty end element from all the arrays that are passed to the register sysctl calls. In some files this means reducing the explicit array size by one. Also make sure that we are using the size in ctl_table_header instead of evaluating the .procname element. Signed-off-by: Joel Granados <j.granados@samsung.com> --- arch/arm/kernel/isa.c | 4 +- arch/arm64/kernel/armv8_deprecated.c | 8 ++-- arch/arm64/kernel/fpsimd.c | 6 +-- arch/arm64/kernel/process.c | 3 +- arch/ia64/kernel/crash.c | 3 +- arch/powerpc/kernel/idle.c | 3 +- arch/powerpc/platforms/pseries/mobility.c | 3 +- arch/s390/appldata/appldata_base.c | 7 ++-- arch/s390/kernel/debug.c | 3 +- arch/s390/kernel/topology.c | 3 +- arch/s390/mm/cmm.c | 3 +- arch/s390/mm/pgalloc.c | 3 +- arch/x86/entry/vdso/vdso32-setup.c | 3 +- arch/x86/kernel/cpu/intel.c | 3 +- arch/x86/kernel/itmt.c | 3 +- crypto/fips.c | 3 +- drivers/base/firmware_loader/fallback_table.c | 3 +- drivers/cdrom/cdrom.c | 3 +- drivers/char/hpet.c | 13 +++--- drivers/char/ipmi/ipmi_poweroff.c | 3 +- drivers/char/random.c | 3 +- drivers/gpu/drm/i915/i915_perf.c | 33 +++++++-------- drivers/hv/hv_common.c | 3 +- drivers/infiniband/core/iwcm.c | 3 +- drivers/infiniband/core/ucma.c | 3 +- drivers/macintosh/mac_hid.c | 3 +- drivers/md/md.c | 3 +- drivers/misc/sgi-xp/xpc_main.c | 6 +-- drivers/net/vrf.c | 3 +- drivers/parport/procfs.c | 42 ++++++++----------- drivers/perf/arm_pmuv3.c | 3 +- drivers/scsi/scsi_sysctl.c | 3 +- drivers/scsi/sg.c | 3 +- drivers/tty/tty_io.c | 3 +- drivers/xen/balloon.c | 3 +- fs/aio.c | 3 +- fs/cachefiles/error_inject.c | 3 +- fs/coda/sysctl.c | 3 +- fs/coredump.c | 3 +- fs/dcache.c | 3 +- fs/devpts/inode.c | 3 +- fs/eventpoll.c | 3 +- fs/exec.c | 3 +- fs/file_table.c | 3 +- fs/inode.c | 3 +- fs/lockd/svc.c | 3 +- fs/locks.c | 3 +- fs/namei.c | 3 +- fs/namespace.c | 3 +- fs/nfs/nfs4sysctl.c | 3 +- fs/nfs/sysctl.c | 3 +- fs/notify/dnotify/dnotify.c | 3 +- fs/notify/fanotify/fanotify_user.c | 3 +- fs/notify/inotify/inotify_user.c | 3 +- fs/ntfs/sysctl.c | 3 +- fs/ocfs2/stackglue.c | 3 +- fs/pipe.c | 3 +- fs/proc/proc_sysctl.c | 8 ++-- fs/quota/dquot.c | 3 +- fs/sysctls.c | 3 +- fs/userfaultfd.c | 3 +- fs/verity/signature.c | 3 +- fs/xfs/xfs_sysctl.c | 4 +- init/do_mounts_initrd.c | 3 +- ipc/ipc_sysctl.c | 3 +- ipc/mq_sysctl.c | 3 +- kernel/acct.c | 3 +- kernel/bpf/syscall.c | 3 +- kernel/delayacct.c | 3 +- kernel/exit.c | 3 +- kernel/hung_task.c | 3 +- kernel/kexec_core.c | 3 +- kernel/kprobes.c | 3 +- kernel/latencytop.c | 3 +- kernel/locking/lockdep.c | 3 +- kernel/panic.c | 3 +- kernel/pid_namespace.c | 3 +- kernel/pid_sysctl.h | 3 +- kernel/printk/sysctl.c | 3 +- kernel/reboot.c | 3 +- kernel/sched/autogroup.c | 3 +- kernel/sched/core.c | 3 +- kernel/sched/deadline.c | 3 +- kernel/sched/fair.c | 3 +- kernel/sched/rt.c | 3 +- kernel/sched/topology.c | 3 +- kernel/seccomp.c | 3 +- kernel/signal.c | 3 +- kernel/stackleak.c | 3 +- kernel/sysctl.c | 6 +-- kernel/time/timer.c | 3 +- kernel/trace/ftrace.c | 3 +- kernel/trace/trace_events_user.c | 3 +- kernel/ucount.c | 7 ++-- kernel/umh.c | 3 +- kernel/utsname_sysctl.c | 3 +- kernel/watchdog.c | 3 +- lib/test_sysctl.c | 6 +-- mm/compaction.c | 3 +- mm/hugetlb.c | 3 +- mm/hugetlb_vmemmap.c | 3 +- mm/memory-failure.c | 3 +- mm/oom_kill.c | 3 +- mm/page-writeback.c | 3 +- net/appletalk/sysctl_net_atalk.c | 3 +- net/ax25/sysctl_net_ax25.c | 5 +-- net/bridge/br_netfilter_hooks.c | 3 +- net/core/neighbour.c | 14 +++---- net/core/sysctl_net_core.c | 6 +-- net/dccp/sysctl.c | 4 +- net/ieee802154/6lowpan/reassembly.c | 6 +-- net/ipv4/devinet.c | 5 +-- net/ipv4/ip_fragment.c | 6 +-- net/ipv4/route.c | 6 +-- net/ipv4/sysctl_net_ipv4.c | 6 +-- net/ipv4/xfrm4_policy.c | 3 +- net/ipv6/addrconf.c | 5 +-- net/ipv6/icmp.c | 3 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 3 +- net/ipv6/reassembly.c | 6 +-- net/ipv6/route.c | 3 +- net/ipv6/sysctl_net_ipv6.c | 6 +-- net/ipv6/xfrm6_policy.c | 3 +- net/llc/sysctl_net_llc.c | 4 +- net/mpls/af_mpls.c | 10 ++--- net/mptcp/ctrl.c | 3 +- net/netfilter/ipvs/ip_vs_ctl.c | 3 +- net/netfilter/ipvs/ip_vs_lblc.c | 3 +- net/netfilter/ipvs/ip_vs_lblcr.c | 3 +- net/netfilter/nf_conntrack_standalone.c | 10 ++--- net/netfilter/nf_log.c | 5 +-- net/netrom/sysctl_net_netrom.c | 3 +- net/phonet/sysctl.c | 3 +- net/rds/ib_sysctl.c | 3 +- net/rds/sysctl.c | 3 +- net/rds/tcp.c | 3 +- net/rose/sysctl_net_rose.c | 3 +- net/rxrpc/sysctl.c | 3 +- net/sctp/sysctl.c | 10 ++--- net/smc/smc_sysctl.c | 3 +- net/sunrpc/sysctl.c | 3 +- net/sunrpc/xprtrdma/svc_rdma.c | 3 +- net/sunrpc/xprtrdma/transport.c | 3 +- net/sunrpc/xprtsock.c | 3 +- net/tipc/sysctl.c | 3 +- net/unix/sysctl_net_unix.c | 3 +- net/x25/sysctl_net_x25.c | 3 +- net/xfrm/xfrm_sysctl.c | 3 +- security/apparmor/lsm.c | 4 +- security/keys/sysctl.c | 7 ++-- security/loadpin/loadpin.c | 3 +- security/yama/yama_lsm.c | 3 +- 152 files changed, 228 insertions(+), 407 deletions(-)