aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/btf.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2024-06-05 00:16:26 +0000
committerDaniel Borkmann <[email protected]>2024-06-05 14:54:32 +0000
commit2bce2c1cb2f0acbf619737a10575f99df0c43984 (patch)
tree000ced203a6a1054130b9a5848f29915b9ea67ad /tools/lib/bpf/btf.c
parentlibbpf: Add BTF field iterator (diff)
downloadkernel-2bce2c1cb2f0acbf619737a10575f99df0c43984.tar.gz
kernel-2bce2c1cb2f0acbf619737a10575f99df0c43984.zip
libbpf: Make use of BTF field iterator in BPF linker code
Switch all BPF linker code dealing with iterating BTF type ID and string offset fields to new btf_field_iter facilities. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Alan Maguire <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/btf.c')
-rw-r--r--tools/lib/bpf/btf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 50ff8b6eaf36..d72260ac26a5 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -5267,7 +5267,7 @@ __u32 *btf_field_iter_next(struct btf_field_iter *it)
return NULL;
if (it->m_idx < 0) {
- if (it->off_idx < it->desc.t_cnt)
+ if (it->off_idx < it->desc.t_off_cnt)
return it->p + it->desc.t_offs[it->off_idx++];
/* move to per-member iteration */
it->m_idx = 0;
@@ -5281,7 +5281,7 @@ __u32 *btf_field_iter_next(struct btf_field_iter *it)
return NULL;
}
- if (it->off_idx >= it->desc.m_cnt) {
+ if (it->off_idx >= it->desc.m_off_cnt) {
/* exhausted this member's fields, go to the next member */
it->m_idx++;
it->p += it->desc.m_sz;