bpf: make an argument const in the bpf_map_sum_elem_count kfunc
authorAnton Protopopov <aspsk@isovalent.com>
Wed, 19 Jul 2023 09:29:51 +0000 (09:29 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Jul 2023 16:48:52 +0000 (09:48 -0700)
We use the map pointer only to read the counter values, no locking
involved, so mark the argument as const.

Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Link: https://lore.kernel.org/r/20230719092952.41202-4-aspsk@isovalent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/map_iter.c

index b67996147895a512a09b23b1035794af1a605d0e..011adb41858e6363b77a8a5a599a17aa574c93d3 100644 (file)
@@ -197,7 +197,7 @@ __diag_push();
 __diag_ignore_all("-Wmissing-prototypes",
                  "Global functions as their definitions will be in vmlinux BTF");
 
-__bpf_kfunc s64 bpf_map_sum_elem_count(struct bpf_map *map)
+__bpf_kfunc s64 bpf_map_sum_elem_count(const struct bpf_map *map)
 {
        s64 *pcount;
        s64 ret = 0;