Skip to content

Commit cf3a73e

Browse files
t-8chgregkh
authored andcommitted
sysctl: treewide: drop unused argument ctl_table_root::set_ownership(table)
[ Upstream commit 520713a ] Remove the 'table' argument from set_ownership as it is never used. This change is a step towards putting "struct ctl_table" into .rodata and eventually having sysctl core only use "const struct ctl_table". The patch was created with the following coccinelle script: @@ identifier func, head, table, uid, gid; @@ void func( struct ctl_table_header *head, - struct ctl_table *table, kuid_t *uid, kgid_t *gid) { ... } No additional occurrences of 'set_ownership' were found after doing a tree-wide search. Reviewed-by: Joel Granados <j.granados@samsung.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Joel Granados <j.granados@samsung.com> Stable-dep-of: 98ca62b ("sysctl: always initialize i_uid/i_gid") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c0d538b commit cf3a73e

File tree

5 files changed

+3
-7
lines changed

5 files changed

+3
-7
lines changed

fs/proc/proc_sysctl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
484484
}
485485

486486
if (root->set_ownership)
487-
root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
487+
root->set_ownership(head, &inode->i_uid, &inode->i_gid);
488488
else {
489489
inode->i_uid = GLOBAL_ROOT_UID;
490490
inode->i_gid = GLOBAL_ROOT_GID;

include/linux/sysctl.h

-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ struct ctl_table_root {
185185
struct ctl_table_set default_set;
186186
struct ctl_table_set *(*lookup)(struct ctl_table_root *root);
187187
void (*set_ownership)(struct ctl_table_header *head,
188-
struct ctl_table *table,
189188
kuid_t *uid, kgid_t *gid);
190189
int (*permissions)(struct ctl_table_header *head, struct ctl_table *table);
191190
};

ipc/ipc_sysctl.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ static int set_is_seen(struct ctl_table_set *set)
192192
}
193193

194194
static void ipc_set_ownership(struct ctl_table_header *head,
195-
struct ctl_table *table,
196195
kuid_t *uid, kgid_t *gid)
197196
{
198197
struct ipc_namespace *ns =
@@ -224,7 +223,7 @@ static int ipc_permissions(struct ctl_table_header *head, struct ctl_table *tabl
224223
kuid_t ns_root_uid;
225224
kgid_t ns_root_gid;
226225

227-
ipc_set_ownership(head, table, &ns_root_uid, &ns_root_gid);
226+
ipc_set_ownership(head, &ns_root_uid, &ns_root_gid);
228227

229228
if (uid_eq(current_euid(), ns_root_uid))
230229
mode >>= 6;

ipc/mq_sysctl.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ static int set_is_seen(struct ctl_table_set *set)
7878
}
7979

8080
static void mq_set_ownership(struct ctl_table_header *head,
81-
struct ctl_table *table,
8281
kuid_t *uid, kgid_t *gid)
8382
{
8483
struct ipc_namespace *ns =
@@ -97,7 +96,7 @@ static int mq_permissions(struct ctl_table_header *head, struct ctl_table *table
9796
kuid_t ns_root_uid;
9897
kgid_t ns_root_gid;
9998

100-
mq_set_ownership(head, table, &ns_root_uid, &ns_root_gid);
99+
mq_set_ownership(head, &ns_root_uid, &ns_root_gid);
101100

102101
if (uid_eq(current_euid(), ns_root_uid))
103102
mode >>= 6;

net/sysctl_net.c

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ static int net_ctl_permissions(struct ctl_table_header *head,
5454
}
5555

5656
static void net_ctl_set_ownership(struct ctl_table_header *head,
57-
struct ctl_table *table,
5857
kuid_t *uid, kgid_t *gid)
5958
{
6059
struct net *net = container_of(head->set, struct net, sysctls);

0 commit comments

Comments
 (0)