diff options
author | Alexei Starovoitov <ast@kernel.org> | 2024-07-22 12:21:22 -0700 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-07-29 13:09:14 -0700 |
commit | e2854bc37344f40a47c6e04a222e65d2669e64dd (patch) | |
tree | 120a17e784ca02ef0cfdd75aecc71ff839e06be5 /kernel/bpf/bpf_struct_ops.c | |
parent | 0d7c06125cea53b3d86d685d790b03b9ae9d6336 (diff) | |
parent | 4009c95fede6b783802ad01f264a7a0541f5ea60 (diff) |
Merge branch 'bpf-retire-the-unsupported_ops-usage-in-struct_ops'
Martin KaFai Lau says:
====================
bpf: Retire the unsupported_ops usage in struct_ops
From: Martin KaFai Lau <martin.lau@kernel.org>
This series retires the unsupported_ops usage and depends on the
null-ness check on the cfi_stubs instead.
Please see individual patches for details.
v2:
- Fixed a gcc compiler warning on Patch 1.
====================
Link: https://lore.kernel.org/r/20240722183049.2254692-1-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'kernel/bpf/bpf_struct_ops.c')
-rw-r--r-- | kernel/bpf/bpf_struct_ops.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index bb3eabc0dc769..fda3dd2ee9844 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -1040,6 +1040,13 @@ void bpf_struct_ops_put(const void *kdata) bpf_map_put(&st_map->map); } +int bpf_struct_ops_supported(const struct bpf_struct_ops *st_ops, u32 moff) +{ + void *func_ptr = *(void **)(st_ops->cfi_stubs + moff); + + return func_ptr ? 0 : -ENOTSUPP; +} + static bool bpf_struct_ops_valid_to_reg(struct bpf_map *map) { struct bpf_struct_ops_map *st_map = (struct bpf_struct_ops_map *)map; |