Skip to content
  • Yonghong Song's avatar
    tools/bpf: fix bpftool map dump with bitfields · 298e59d3
    Yonghong Song authored
    Commit 8772c8bc ("tools: bpftool: support pretty print
    with kind_flag set") added bpftool map dump with kind_flag
    support. When bitfield_size can be retrieved directly from
    btf_member, function btf_dumper_bitfield() is called to
    dump the bitfield. The implementation passed the
    wrong parameter "bit_offset" to the function. The excepted
    value is the bit_offset within a byte while the passed-in
    value is the struct member offset.
    
    This commit fixed the bug with passing correct "bit_offset"
    with adjusted data pointer.
    
    Fixes: 8772c8bc
    
     ("tools: bpftool: support pretty print with kind_flag set")
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    298e59d3