summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Bauer <lmb@cloudflare.com>2020-09-21 13:12:17 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-09-21 15:00:40 -0700
commit2af30f115d6957f372ce3096c7198763ff253d97 (patch)
tree7655d8c52395897f167cfbd5067ed37d8fdea6cd
parent31f23a6a181c81543b10a1a9056b0e6c7ef1c747 (diff)
btf: Make btf_set_contains take a const pointer
bsearch doesn't modify the contents of the array, so we can take a const pointer. Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200921121227.255763-2-lmb@cloudflare.com
-rw-r--r--include/linux/bpf.h2
-rw-r--r--kernel/bpf/btf.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index d7c5a6ed87e3..0478b20d335b 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1905,6 +1905,6 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
void *addr1, void *addr2);
struct btf_id_set;
-bool btf_id_set_contains(struct btf_id_set *set, u32 id);
+bool btf_id_set_contains(const struct btf_id_set *set, u32 id);
#endif /* _LINUX_BPF_H */
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index f9ac6935ab3c..a2330f6fe2e6 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -4772,7 +4772,7 @@ static int btf_id_cmp_func(const void *a, const void *b)
return *pa - *pb;
}
-bool btf_id_set_contains(struct btf_id_set *set, u32 id)
+bool btf_id_set_contains(const struct btf_id_set *set, u32 id)
{
return bsearch(&id, set->ids, set->cnt, sizeof(u32), btf_id_cmp_func) != NULL;
}