diff options
author | Dave Marchevsky <davemarchevsky@fb.com> | 2023-03-09 19:01:08 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-03-10 21:16:37 +0100 |
commit | 74843b57ec70af7b67b7e6153374834ee18d139f (patch) | |
tree | 4dbd38f4cfe9551faad503a47453755b7093f8f8 /kernel/bpf/syscall.c | |
parent | bpf: btf: Remove unused btf_field_info_type enum (diff) | |
download | linux-74843b57ec70af7b67b7e6153374834ee18d139f.tar.xz linux-74843b57ec70af7b67b7e6153374834ee18d139f.zip |
bpf: Change btf_record_find enum parameter to field_mask
btf_record_find's 3rd parameter can be multiple enum btf_field_type's
masked together. The function is called with BPF_KPTR in two places in
verifier.c, so it works with masked values already.
Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/r/20230309180111.1618459-4-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index f406dfa13792..cc4b7684910c 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -520,14 +520,14 @@ static int btf_field_cmp(const void *a, const void *b) } struct btf_field *btf_record_find(const struct btf_record *rec, u32 offset, - enum btf_field_type type) + u32 field_mask) { struct btf_field *field; - if (IS_ERR_OR_NULL(rec) || !(rec->field_mask & type)) + if (IS_ERR_OR_NULL(rec) || !(rec->field_mask & field_mask)) return NULL; field = bsearch(&offset, rec->fields, rec->cnt, sizeof(rec->fields[0]), btf_field_cmp); - if (!field || !(field->type & type)) + if (!field || !(field->type & field_mask)) return NULL; return field; } |