diff options
| author | Yonghong Song <yonghong.song@linux.dev> | 2026-08-28 23:15:29 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-08-29 18:16:32 -0700 |
| commit | 3fc3e7331af6f60979fdf55e776bfe67105b584a (patch) | |
| tree | f0dca4d47a6a64aab8b3af63711e12f18206e59a /include/linux | |
| parent | 77983371742e37ff3117acdc5dfb1969cedd415c (diff) | |
| download | linux-next-3fc3e7331af6f60979fdf55e776bfe67105b584a.tar.gz linux-next-3fc3e7331af6f60979fdf55e776bfe67105b584a.zip | |
bpf: Add btf_type_is_arena_ptr()
Add btf_type_is_arena_ptr() to test whether a BTF type is a pointer
carrying the "arena" type tag, and use it to simplify both
btf_scan_type_tags() and btf_validate_return_type(). The helper has
external linkage because a later patch calls it from verifier.c to
decide whether a struct member returned by value may be an arena
pointer.
btf_scan_type_tags() drove btf_type_tag_walk() with a one-entry match
table, so the "multiple type tags" error it checked for could never
fire: btf_type_tag_walk() only fails when the walk sets more than one
flag. Dropping that error path, and with it the int return, is
therefore no functional change.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260829061529.1693266-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/btf.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/btf.h b/include/linux/btf.h index 89d5a5c4f117..ddd0f4f32d24 100644 --- a/include/linux/btf.h +++ b/include/linux/btf.h @@ -235,6 +235,7 @@ struct btf_record *btf_parse_fields(const struct btf *btf, const struct btf_type u32 field_mask, u32 value_size); int btf_check_and_fixup_fields(const struct btf *btf, struct btf_record *rec); bool btf_type_is_void(const struct btf_type *t); +bool btf_type_is_arena_ptr(const struct btf *btf, const struct btf_type *t); s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind); s32 bpf_find_btf_id(const char *name, u32 kind, struct btf **btf_p); struct btf *btf_get_module_btf(const struct module *module); |
