WSL2-Linux-Kernel/tools/lib/bpf
Eduard Zingerman c862d7debe bpftool: Print newline before '}' for struct with padding only fields
[ Upstream commit 44a726c3f2 ]

btf_dump_emit_struct_def attempts to print empty structures at a
single line, e.g. `struct empty {}`. However, it has to account for a
case when there are no regular but some padding fields in the struct.
In such case `vlen` would be zero, but size would be non-zero.

E.g. here is struct bpf_timer from vmlinux.h before this patch:

 struct bpf_timer {
 	long: 64;
	long: 64;};

And after this patch:

 struct bpf_dynptr {
 	long: 64;
	long: 64;
 };

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221001104425.415768-1-eddyz87@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-13 16:48:27 +02:00
..
.gitignore
Build
Makefile
bpf.c
bpf.h libbpf: Avoid enum forward-declarations in public API in C++ mode 2022-12-31 13:14:43 +01:00
bpf_core_read.h
bpf_endian.h
bpf_gen_internal.h
bpf_helpers.h
bpf_prog_linfo.c
bpf_tracing.h
btf.c libbpf: Fix btf__align_of() by taking into account field offsets 2023-03-10 09:39:06 +01:00
btf.h
btf_dump.c bpftool: Print newline before '}' for struct with padding only fields 2023-04-13 16:48:27 +02:00
gen_loader.c libbpf: fix an snprintf() overflow check 2022-08-17 14:23:32 +02:00
hashmap.c
hashmap.h
libbpf.c libbpf: Fix null-pointer dereference in find_prog_by_sec_insn() 2022-12-31 13:14:06 +01:00
libbpf.h
libbpf.map
libbpf.pc.template
libbpf_common.h
libbpf_errno.c
libbpf_internal.h
libbpf_legacy.h
libbpf_probes.c libbpf: Use page size as max_entries when probing ring buffer map 2022-12-19 12:36:41 +01:00
linker.c
netlink.c
nlattr.c libbpf: Fix alen calculation in libbpf_nla_dump_errormsg() 2023-03-10 09:39:16 +01:00
nlattr.h
relo_core.c
relo_core.h
ringbuf.c libbpf: Handle size overflow for ringbuf mmap 2022-12-08 11:28:39 +01:00
skel_internal.h
str_error.c
str_error.h
strset.c
strset.h
xsk.c selftests/xsk: Avoid use-after-free on ctx 2022-10-26 12:34:41 +02:00
xsk.h