diff options
author | Martin KaFai Lau <kafai@fb.com> | 2018-12-05 17:35:47 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-12-05 18:48:40 -0800 |
commit | 84ecc1f98ca7ce28ede9bc5cc70a557fdfa09caa (patch) | |
tree | d1b34c120c66dd799428ca4e61bf8ed710f4ae3e /tools/bpf/bpftool/prog.c | |
parent | 555249df711b146a2898949ac80503be29fe7340 (diff) |
bpf: Expect !info.func_info and insn_off name changes in test_btf/libbpf/bpftool
Similar to info.jited_*, info.func_info could be 0 if
bpf_dump_raw_ok() == false.
This patch makes changes to test_btf and bpftool to expect info.func_info
could be 0.
This patch also makes the needed changes for s/insn_offset/insn_off/.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
-rw-r--r-- | tools/bpf/bpftool/prog.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index 54c8dbf05c9c..a9a51123454c 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -589,6 +589,13 @@ static int do_dump(int argc, char **argv) goto err_free; } + if (func_info && !info.func_info) { + /* kernel.kptr_restrict is set. No func_info available. */ + free(func_info); + func_info = NULL; + finfo_cnt = 0; + } + if ((member_len == &info.jited_prog_len && info.jited_prog_insns == 0) || (member_len == &info.xlated_prog_len && |