WARNING: line length of 99 exceeds 80 columns #66: FILE: tools/lib/bpf/btf.c:3046: +static int info_subsec_bswap_metadata(const struct btf_ext *btf_ext, struct btf_ext_info *ext_info) CHECK: Macro argument 'btf_ext' may be better as '(btf_ext)' to avoid precedence issues #98: FILE: tools/lib/bpf/btf.c:3078: +#define ORDER_INFO_BSWAP(btf_ext, ext_info, info_t, swap_fn) \ +{ \ + const bool is_native = btf_ext->swapped_endian; \ + struct btf_ext_info_sec *si; \ + int c, err; \ + info_t *i; \ + if (is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ + err = info_subsec_bswap_metadata(btf_ext, ext_info); \ + if (err) { \ + pr_warn(#info_t " record size mismatch!\n"); \ + return err; \ + } \ + if (!is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ +} CHECK: Macro argument 'info_t' may be better as '(info_t)' to avoid precedence issues #98: FILE: tools/lib/bpf/btf.c:3078: +#define ORDER_INFO_BSWAP(btf_ext, ext_info, info_t, swap_fn) \ +{ \ + const bool is_native = btf_ext->swapped_endian; \ + struct btf_ext_info_sec *si; \ + int c, err; \ + info_t *i; \ + if (is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ + err = info_subsec_bswap_metadata(btf_ext, ext_info); \ + if (err) { \ + pr_warn(#info_t " record size mismatch!\n"); \ + return err; \ + } \ + if (!is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ +} WARNING: Macros with flow control statements should be avoided #98: FILE: tools/lib/bpf/btf.c:3078: +#define ORDER_INFO_BSWAP(btf_ext, ext_info, info_t, swap_fn) \ +{ \ + const bool is_native = btf_ext->swapped_endian; \ + struct btf_ext_info_sec *si; \ + int c, err; \ + info_t *i; \ + if (is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ + err = info_subsec_bswap_metadata(btf_ext, ext_info); \ + if (err) { \ + pr_warn(#info_t " record size mismatch!\n"); \ + return err; \ + } \ + if (!is_native) \ + for_each_btf_ext_sec(ext_info, si) \ + for_each_btf_ext_rec(ext_info, si, c, i) \ + swap_fn(i); \ +} WARNING: line length of 83 exceeds 80 columns #134: FILE: tools/lib/bpf/btf.c:3114: + ORDER_INFO_BSWAP(btf_ext, &ext, struct bpf_func_info, bpf_func_info_bswap); WARNING: line length of 83 exceeds 80 columns #141: FILE: tools/lib/bpf/btf.c:3121: + ORDER_INFO_BSWAP(btf_ext, &ext, struct bpf_line_info, bpf_line_info_bswap); WARNING: line length of 83 exceeds 80 columns #151: FILE: tools/lib/bpf/btf.c:3131: + ORDER_INFO_BSWAP(btf_ext, &ext, struct bpf_core_relo, bpf_core_relo_bswap); CHECK: Please use a blank line after function/struct/union/enum declarations #155: FILE: tools/lib/bpf/btf.c:3135: +} +#undef ORDER_INFO_BSWAP WARNING: Missing a blank line after declarations #226: FILE: tools/lib/bpf/btf.c:3204: + int err = btf_ext_bswap_info(btf_ext); + if (err) WARNING: line length of 84 exceeds 80 columns #315: FILE: tools/lib/bpf/btf.c:3320: + return btf_ext->swapped_endian ? BTF_LITTLE_ENDIAN : BTF_BIG_ENDIAN; WARNING: line length of 84 exceeds 80 columns #317: FILE: tools/lib/bpf/btf.c:3322: + return btf_ext->swapped_endian ? BTF_BIG_ENDIAN : BTF_LITTLE_ENDIAN; WARNING: line length of 85 exceeds 80 columns #325: FILE: tools/lib/bpf/btf.c:3330: + btf_ext->swapped_endian = is_host_big_endian() != (endian == BTF_BIG_ENDIAN); WARNING: line length of 82 exceeds 80 columns #344: FILE: tools/lib/bpf/btf.h:170: +LIBBPF_API enum btf_endianness btf_ext__endianness(const struct btf_ext *btf_ext); total: 0 errors, 10 warnings, 3 checks, 351 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. Commit 31de6e0e1428 ("libbpf: Support BTF.ext loading and output in either endianness") has style problems, please review. NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. total: 0 errors, 10 warnings, 3 checks, 351 lines checked