Skip to content

Commit bfa858f

Browse files
t-8chdavem330
authored andcommitted
sysctl: treewide: constify ctl_table_header::ctl_table_arg
To be able to constify instances of struct ctl_tables it is necessary to remove ways through which non-const versions are exposed from the sysctl core. One of these is the ctl_table_arg member of struct ctl_table_header. Constify this reference as a prerequisite for the full constification of struct ctl_table instances. No functional change. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8442f8b commit bfa858f

File tree

27 files changed

+30
-30
lines changed

27 files changed

+30
-30
lines changed

drivers/net/vrf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ static int vrf_netns_init_sysctl(struct net *net, struct netns_vrf *nn_vrf)
19711971
static void vrf_netns_exit_sysctl(struct net *net)
19721972
{
19731973
struct netns_vrf *nn_vrf = net_generic(net, vrf_net_id);
1974-
struct ctl_table *table;
1974+
const struct ctl_table *table;
19751975

19761976
table = nn_vrf->ctl_hdr->ctl_table_arg;
19771977
unregister_net_sysctl_table(nn_vrf->ctl_hdr);

include/linux/sysctl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ struct ctl_table_header {
182182
struct rcu_head rcu;
183183
};
184184
struct completion *unregistering;
185-
struct ctl_table *ctl_table_arg;
185+
const struct ctl_table *ctl_table_arg;
186186
struct ctl_table_root *root;
187187
struct ctl_table_set *set;
188188
struct ctl_dir *parent;

ipc/ipc_sysctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns)
306306

307307
void retire_ipc_sysctls(struct ipc_namespace *ns)
308308
{
309-
struct ctl_table *tbl;
309+
const struct ctl_table *tbl;
310310

311311
tbl = ns->ipc_sysctls->ctl_table_arg;
312312
unregister_sysctl_table(ns->ipc_sysctls);

ipc/mq_sysctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ bool setup_mq_sysctls(struct ipc_namespace *ns)
160160

161161
void retire_mq_sysctls(struct ipc_namespace *ns)
162162
{
163-
struct ctl_table *tbl;
163+
const struct ctl_table *tbl;
164164

165165
tbl = ns->mq_sysctls->ctl_table_arg;
166166
unregister_sysctl_table(ns->mq_sysctls);

kernel/ucount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bool setup_userns_sysctls(struct user_namespace *ns)
119119
void retire_userns_sysctls(struct user_namespace *ns)
120120
{
121121
#ifdef CONFIG_SYSCTL
122-
struct ctl_table *tbl;
122+
const struct ctl_table *tbl;
123123

124124
tbl = ns->sysctls->ctl_table_arg;
125125
unregister_sysctl_table(ns->sysctls);

net/ax25/sysctl_net_ax25.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int ax25_register_dev_sysctl(ax25_dev *ax25_dev)
171171
void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev)
172172
{
173173
struct ctl_table_header *header = ax25_dev->sysheader;
174-
struct ctl_table *table;
174+
const struct ctl_table *table;
175175

176176
if (header) {
177177
ax25_dev->sysheader = NULL;

net/bridge/br_netfilter_hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ static int br_netfilter_sysctl_init_net(struct net *net)
12751275
static void br_netfilter_sysctl_exit_net(struct net *net,
12761276
struct brnf_net *brnet)
12771277
{
1278-
struct ctl_table *table = brnet->ctl_hdr->ctl_table_arg;
1278+
const struct ctl_table *table = brnet->ctl_hdr->ctl_table_arg;
12791279

12801280
unregister_net_sysctl_table(brnet->ctl_hdr);
12811281
if (!net_eq(net, &init_net))

net/core/sysctl_net_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static __net_init int sysctl_core_net_init(struct net *net)
743743

744744
static __net_exit void sysctl_core_net_exit(struct net *net)
745745
{
746-
struct ctl_table *tbl;
746+
const struct ctl_table *tbl;
747747

748748
tbl = net->core.sysctl_hdr->ctl_table_arg;
749749
unregister_net_sysctl_table(net->core.sysctl_hdr);

net/ieee802154/6lowpan/reassembly.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
399399

400400
static void __net_exit lowpan_frags_ns_sysctl_unregister(struct net *net)
401401
{
402-
struct ctl_table *table;
402+
const struct ctl_table *table;
403403
struct netns_ieee802154_lowpan *ieee802154_lowpan =
404404
net_ieee802154_lowpan(net);
405405

net/ipv4/devinet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2749,7 +2749,7 @@ static __net_init int devinet_init_net(struct net *net)
27492749
static __net_exit void devinet_exit_net(struct net *net)
27502750
{
27512751
#ifdef CONFIG_SYSCTL
2752-
struct ctl_table *tbl;
2752+
const struct ctl_table *tbl;
27532753

27542754
tbl = net->ipv4.forw_hdr->ctl_table_arg;
27552755
unregister_net_sysctl_table(net->ipv4.forw_hdr);

0 commit comments

Comments
 (0)