]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: Constify ctl_table argument of filter function
authorThomas Weißschuh <linux@weissschuh.net>
Mon, 5 Aug 2024 09:39:36 +0000 (11:39 +0200)
committerJoel Granados <joel.granados@kernel.org>
Wed, 9 Oct 2024 11:39:11 +0000 (13:39 +0200)
The sysctl core is moving to allow "struct ctl_table" in read-only memory.
As a preparation for that all functions handling "struct ctl_table" need
to be able to work with "const struct ctl_table".
As __cgroup_bpf_run_filter_sysctl() does not modify its table, it can be
adapted trivially.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
include/linux/bpf-cgroup.h
kernel/bpf/cgroup.c

index ce91d9b2acb9f8991150ceead4475b130bead438..4dd17128b204bdbfbfaadde5a53ab53b6662e8c0 100644 (file)
@@ -138,7 +138,7 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
                                      short access, enum cgroup_bpf_attach_type atype);
 
 int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
-                                  struct ctl_table *table, int write,
+                                  const struct ctl_table *table, int write,
                                   char **buf, size_t *pcount, loff_t *ppos,
                                   enum cgroup_bpf_attach_type atype);
 
index e7113d700b87848b4446e8ee38764c1ff904307d..9c951b4212a27cae2f71070e9f9b3e1fdcee9ed1 100644 (file)
@@ -1691,7 +1691,7 @@ const struct bpf_verifier_ops cg_dev_verifier_ops = {
  * returned value != 1 during execution. In all other cases 0 is returned.
  */
 int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
-                                  struct ctl_table *table, int write,
+                                  const struct ctl_table *table, int write,
                                   char **buf, size_t *pcount, loff_t *ppos,
                                   enum cgroup_bpf_attach_type atype)
 {