diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-03-03 10:08:00 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-03-03 16:41:36 -0800 |
commit | 320a36063e1441210106aa33997ad3770d4c86b4 (patch) | |
tree | a8b7de3d5af8f83f95546557c6a888d52396ca94 /tools/lib | |
parent | 5fc40f37396cec199d40a417df74b39c8e458ca6 (diff) | |
download | linux-320a36063e1441210106aa33997ad3770d4c86b4.tar.bz2 |
libbpf: Fix handling of optional field_name in btf_dump__emit_type_decl
Internal functions, used by btf_dump__emit_type_decl(), assume field_name is
never going to be NULL. Ensure it's always the case.
Fixes: 9f81654eebe8 ("libbpf: Expose BTF-to-C type declaration emitting API")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200303180800.3303471-1-andriin@fb.com
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/btf_dump.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index bd09ed1710f1..dc451e4de5ad 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -1030,7 +1030,7 @@ int btf_dump__emit_type_decl(struct btf_dump *d, __u32 id, if (!OPTS_VALID(opts, btf_dump_emit_type_decl_opts)) return -EINVAL; - fname = OPTS_GET(opts, field_name, NULL); + fname = OPTS_GET(opts, field_name, ""); lvl = OPTS_GET(opts, indent_level, 0); btf_dump_emit_type_decl(d, id, fname, lvl); return 0; |