summaryrefslogtreecommitdiff
path: root/kernel/bpf/core.c
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2018-07-13 12:41:10 -0700
committerMichael Bestas <mkbestas@lineageos.org>2022-04-19 00:51:51 +0300
commitf153a4358cef111524bc2e3706ebd030e14a540a (patch)
tree49cd1ea88bc020369246609b51347c5445fb3f7d /kernel/bpf/core.c
parentf10e982d3b2ead1b049225b5bd8b149a43e3705b (diff)
UPSTREAM: bpf: bpf_prog_array_alloc() should return a generic non-rcu pointer
Currently the return type of the bpf_prog_array_alloc() is struct bpf_prog_array __rcu *, which is not quite correct. Obviously, the returned pointer is a generic pointer, which is valid for an indefinite amount of time and it's not shared with anyone else, so there is no sense in marking it as __rcu. This change eliminate the following sparse warnings: kernel/bpf/core.c:1544:31: warning: incorrect type in return expression (different address spaces) kernel/bpf/core.c:1544:31: expected struct bpf_prog_array [noderef] <asn:4>* kernel/bpf/core.c:1544:31: got void * kernel/bpf/core.c:1548:17: warning: incorrect type in return expression (different address spaces) kernel/bpf/core.c:1548:17: expected struct bpf_prog_array [noderef] <asn:4>* kernel/bpf/core.c:1548:17: got struct bpf_prog_array *<noident> kernel/bpf/core.c:1681:15: warning: incorrect type in assignment (different address spaces) kernel/bpf/core.c:1681:15: expected struct bpf_prog_array *array kernel/bpf/core.c:1681:15: got struct bpf_prog_array [noderef] <asn:4>* Fixes: 324bda9e6c5a ("bpf: multi program support for cgroup+bpf") Signed-off-by: Roman Gushchin <guro@fb.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> (cherry picked from commit d29ab6e1fa21ebc2a8a771015dd9e0e5d4e28dc1) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I18f048dfa46935e6c23744879f04a93b2a747233
Diffstat (limited to 'kernel/bpf/core.c')
-rw-r--r--kernel/bpf/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 5c6f4cb9a6c2..6e407cd56cc4 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1098,7 +1098,7 @@ static struct {
.null_prog = NULL,
};
-struct bpf_prog_array __rcu *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags)
+struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags)
{
if (prog_cnt)
return kzalloc(sizeof(struct bpf_prog_array) +