sysctl: treewide: drop unused argument ctl_table_root::set_ownership(table)
authorThomas Weißschuh <linux@weissschuh.net>
Fri, 15 Mar 2024 18:11:30 +0000 (19:11 +0100)
committerJoel Granados <j.granados@samsung.com>
Wed, 24 Apr 2024 07:43:54 +0000 (09:43 +0200)
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>
fs/proc/proc_sysctl.c
include/linux/sysctl.h
ipc/ipc_sysctl.c
ipc/mq_sysctl.c
net/sysctl_net.c

index 37cde0efee5707d8a1e9d7faa405977aa6c72555..ed3a41ed97055481fc4cfedcad7db471a26ee77c 100644 (file)
@@ -480,7 +480,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
        }
 
        if (root->set_ownership)
-               root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
+               root->set_ownership(head, &inode->i_uid, &inode->i_gid);
        else {
                inode->i_uid = GLOBAL_ROOT_UID;
                inode->i_gid = GLOBAL_ROOT_GID;
index ee7d33b89e9ef3d44bfa45640343ddc5c2f59113..60333a6b9370ad3ab0cb469e56d2aaf9b66b549a 100644 (file)
@@ -205,7 +205,6 @@ struct ctl_table_root {
        struct ctl_table_set default_set;
        struct ctl_table_set *(*lookup)(struct ctl_table_root *root);
        void (*set_ownership)(struct ctl_table_header *head,
-                             struct ctl_table *table,
                              kuid_t *uid, kgid_t *gid);
        int (*permissions)(struct ctl_table_header *head, struct ctl_table *table);
 };
index 45cb1dabce29ae0ab553c6d8f04808fe8e7f3232..1a5085e5b1785cf712d2ea3b0753d6668babb0fb 100644 (file)
@@ -192,7 +192,6 @@ static int set_is_seen(struct ctl_table_set *set)
 }
 
 static void ipc_set_ownership(struct ctl_table_header *head,
-                             struct ctl_table *table,
                              kuid_t *uid, kgid_t *gid)
 {
        struct ipc_namespace *ns =
@@ -224,7 +223,7 @@ static int ipc_permissions(struct ctl_table_header *head, struct ctl_table *tabl
                kuid_t ns_root_uid;
                kgid_t ns_root_gid;
 
-               ipc_set_ownership(head, table, &ns_root_uid, &ns_root_gid);
+               ipc_set_ownership(head, &ns_root_uid, &ns_root_gid);
 
                if (uid_eq(current_euid(), ns_root_uid))
                        mode >>= 6;
index 21fba3a6edaf7a0c2e96c31ff34b761cff6b79e0..6bb1c5397c69b950af0e3da51046f1e805b6d14a 100644 (file)
@@ -78,7 +78,6 @@ static int set_is_seen(struct ctl_table_set *set)
 }
 
 static void mq_set_ownership(struct ctl_table_header *head,
-                            struct ctl_table *table,
                             kuid_t *uid, kgid_t *gid)
 {
        struct ipc_namespace *ns =
@@ -97,7 +96,7 @@ static int mq_permissions(struct ctl_table_header *head, struct ctl_table *table
        kuid_t ns_root_uid;
        kgid_t ns_root_gid;
 
-       mq_set_ownership(head, table, &ns_root_uid, &ns_root_gid);
+       mq_set_ownership(head, &ns_root_uid, &ns_root_gid);
 
        if (uid_eq(current_euid(), ns_root_uid))
                mode >>= 6;
index 051ed5f6fc9372f3a8e5057ac5508468cbadbe76..a0a7a79991f9ffa89d80916e89454b470a48285b 100644 (file)
@@ -54,7 +54,6 @@ static int net_ctl_permissions(struct ctl_table_header *head,
 }
 
 static void net_ctl_set_ownership(struct ctl_table_header *head,
-                                 struct ctl_table *table,
                                  kuid_t *uid, kgid_t *gid)
 {
        struct net *net = container_of(head->set, struct net, sysctls);