diff options
author | Yonghong Song <yhs@fb.com> | 2019-01-10 11:14:00 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-01-11 10:40:54 +0100 |
commit | 17e3ac812541f73224299d8958ddb420c2d5bbd8 (patch) | |
tree | b6fe6e825c88f12b2e2a20f711701af97af15b86 /tools | |
parent | beaf3d1901f4ea46fbd5c9d857227d99751de469 (diff) | |
download | linux-stable-17e3ac812541f73224299d8958ddb420c2d5bbd8.tar.gz linux-stable-17e3ac812541f73224299d8958ddb420c2d5bbd8.tar.bz2 linux-stable-17e3ac812541f73224299d8958ddb420c2d5bbd8.zip |
bpf: fix bpffs bitfield pretty print
Commit 9d5f9f701b18 ("bpf: btf: fix struct/union/fwd types
with kind_flag") introduced kind_flag and used bitfield_size
in the btf_member to directly pretty print member values.
The commit contained a bug where the incorrect parameters could be
passed to function btf_bitfield_seq_show(). The bits_offset
parameter in the function expects a value less than 8.
Instead, the member offset in the structure is passed.
The below is btf_bitfield_seq_show() func signature:
void btf_bitfield_seq_show(void *data, u8 bits_offset,
u8 nr_bits, struct seq_file *m)
both bits_offset and nr_bits are u8 type. If the bitfield
member offset is greater than 256, incorrect value will
be printed.
This patch fixed the issue by calculating correct proper
data offset and bits_offset similar to non kind_flag case.
Fixes: 9d5f9f701b18 ("bpf: btf: fix struct/union/fwd types with kind_flag")
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions