WARNING: Improper SPDX comment style for 'tools/testing/selftests/bpf/libarena/include/buddy.h', please use '/*' instead #25: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:1: +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #25: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:1: +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause WARNING: do not add new typedefs #32: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:8: +typedef struct buddy_chunk __arena buddy_chunk_t; WARNING: do not add new typedefs #35: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:11: +typedef struct buddy_header __arena buddy_header_t; WARNING: line length of 82 exceeds 80 columns #41: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:17: + BUDDY_CHUNK_BYTES = BUDDY_MIN_ALLOC_BYTES << BUDDY_CHUNK_NUM_ORDERS, WARNING: line length of 90 exceeds 80 columns #42: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:18: + BUDDY_HEADER_OFF = 8, /* header byte offset, see buddy.bpf.c for details */ WARNING: line length of 85 exceeds 80 columns #46: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:22: + BUDDY_VADDR_OFFSET = BUDDY_CHUNK_BYTES, /* Start aligning at chunk */ WARNING: line length of 83 exceeds 80 columns #47: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:23: + BUDDY_VADDR_SIZE = BUDDY_CHUNK_BYTES << 10 /* 1024 chunks maximum */ WARNING: line length of 94 exceeds 80 columns #51: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:27: + u32 prev_index; /* "Pointer" to the previous available allocation of the same size. */ ERROR: trailing whitespace #61: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:37: +^I/* $ WARNING: line length of 87 exceeds 80 columns #73: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:49: + buddy_chunk_t *first_chunk; /* Pointer to the chunk linked list. */ WARNING: Missing a blank line after declarations #74: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:50: + buddy_chunk_t *first_chunk; /* Pointer to the chunk linked list. */ + arena_spinlock_t __arena *lock; /* Allocator lock */ WARNING: line length of 84 exceeds 80 columns #75: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:51: + u64 vaddr; /* Allocation into reserved vaddr */ WARNING: line length of 89 exceeds 80 columns #83: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:59: +#define buddy_free(buddy, ptr) do { buddy_free_internal((buddy), (u64)(ptr)); } while (0) WARNING: Single statement macros should not use a do {} while (0) loop #83: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:59: +#define buddy_free(buddy, ptr) do { buddy_free_internal((buddy), (u64)(ptr)); } while (0) WARNING: line length of 88 exceeds 80 columns #85: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:61: +#define buddy_alloc(alloc, size) ((void __arena *)buddy_alloc_internal((alloc), (size))) CHECK: Please don't use multiple blank lines #87: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:63: + + CHECK: Lines should not end with a '(' #135: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:41: + bpf_arena_free_pages( ERROR: trailing whitespace #142: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:48: +/* $ CHECK: spaces preferred around that '*' (ctx:WxV) #191: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:97: +int idx_set_allocated(buddy_chunk_t __arg_arena *chunk, u64 idx, bool allocated) ^ WARNING: Possible repeated word: 'of' #194: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:100: + arena_stderr("setting state of of invalid idx (%d, max %d)\n", idx, WARNING: line length of 83 exceeds 80 columns #194: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:100: + arena_stderr("setting state of of invalid idx (%d, max %d)\n", idx, WARNING: line length of 82 exceeds 80 columns #210: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:116: + arena_stderr("getting state of invalid idx (%llu, max %d)\n", idx, CHECK: spaces preferred around that '*' (ctx:WxV) #220: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:126: +int idx_set_order(buddy_chunk_t __arg_arena *chunk, u64 idx, u8 order) ^ ERROR: trailing whitespace #235: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:141: +^I/* $ ERROR: trailing whitespace #310: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:216: +^I/* $ WARNING: line length of 81 exceeds 80 columns #312: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:218: + * to the header because of off-by-one errors when using adjacent blocks. ERROR: trailing whitespace #318: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:224: +^I * $ WARNING: line length of 81 exceeds 80 columns #319: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:225: + * As a result, we have only two possible positions for the header: Bytes WARNING: line length of 84 exceeds 80 columns #320: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:226: + * 0 and 8. Keeping the header in byte 0 means off-by-ones from the previous WARNING: line length of 81 exceeds 80 columns #321: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:227: + * block touch the header, and, since the header must be accessible, ASAN WARNING: line length of 86 exceeds 80 columns #322: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:228: + * will not trigger. Keeping the header on byte 8 means off-by-one errors from ERROR: trailing whitespace #323: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:229: +^I * the previous block are caught by ASAN. Negative offsets are rarer, so $ WARNING: line length of 81 exceeds 80 columns #323: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:229: + * the previous block are caught by ASAN. Negative offsets are rarer, so WARNING: line length of 83 exceeds 80 columns #324: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:230: + * while accesses into the block from the next block are possible, they are CHECK: spaces preferred around that '*' (ctx:WxV) #395: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:301: +int add_leftovers_to_freelist(buddy_chunk_t __arg_arena *chunk, u32 cur_idx, ^ CHECK: Alignment should match open parenthesis #396: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:302: +int add_leftovers_to_freelist(buddy_chunk_t __arg_arena *chunk, u32 cur_idx, + u64 min_order, u64 max_order) ERROR: do not use assignment in if condition #450: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:356: + if ((ret = buddy_lock(buddy))) { ERROR: trailing whitespace #487: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:393: +^I * - cur_index: Current index into the top-level block we are $ ERROR: trailing whitespace #489: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:395: +^I * $ WARNING: line length of 85 exceeds 80 columns #491: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:397: + * - Find the largest power-of-2 allocation still smaller than left (infimum) ERROR: trailing whitespace #493: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:399: +^I * - For every order from [infimum + 1, last order), carve out a block $ ERROR: trailing whitespace #501: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:407: +^I * 0 ^I 64^I128^I^I 1 << 20^I$ WARNING: please, no space before tabs #501: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:407: +^I * 0 ^I 64^I128^I^I 1 << 20^I$ WARNING: please, no space before tabs #505: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:411: +^I * ^I[0, 64)^I^I- Completely allocated$ WARNING: please, no space before tabs #506: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:412: +^I * ^I[64, 128)^I- Will be further split in the next iteration$ ERROR: trailing whitespace #507: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:413: +^I * $ WARNING: please, no space before tabs #509: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:415: +^I * ^I[128, 256)$ WARNING: please, no space before tabs #510: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:416: +^I * ^I[256, 512)$ WARNING: please, no space before tabs #511: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:417: +^I * ^I...$ WARNING: please, no space before tabs #512: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:418: +^I * ^I[1 << 18, 1 << 19)$ WARNING: please, no space before tabs #513: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:419: +^I * ^I[1 << 19, 1 << 20)$ WARNING: please, no space before tabs #518: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:424: +^I * 64^I 80^I96^I^I ^I64 + 1 << 6 = 128$ WARNING: please, no space before tabs #522: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:428: +^I * ^I[64, 80)^I- Completely allocated$ ERROR: trailing whitespace #523: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:429: +^I * $ WARNING: please, no space before tabs #526: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:432: +^I * ^I[96, 128)$ CHECK: Lines should not end with a '(' #534: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:440: + arena_stderr( CHECK: Lines should not end with a '(' #537: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:443: + arena_stderr( WARNING: line length of 95 exceeds 80 columns #548: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:454: + order = (power2 >= BUDDY_MIN_ALLOC_SHIFT) ? power2 - BUDDY_MIN_ALLOC_SHIFT : 0; ERROR: trailing whitespace #552: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:458: +^I^I/* $ WARNING: line length of 82 exceeds 80 columns #558: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:464: + if (add_leftovers_to_freelist(chunk, idx, min_order, max_order)) { ERROR: trailing whitespace #571: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:477: +__hidden int buddy_init(struct buddy *buddy, $ CHECK: Alignment should match open parenthesis #572: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:478: +__hidden int buddy_init(struct buddy *buddy, + arena_spinlock_t __arg_arena __arena *lock) ERROR: trailing whitespace #582: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:488: +^I/* $ ERROR: do not use assignment in if condition #585: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:491: + if ((ret = buddy_reserve_arena_vaddr(buddy))) CHECK: spaces preferred around that '*' (ctx:WxV) #646: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:552: +__weak u64 buddy_chunk_alloc(buddy_chunk_t __arg_arena *chunk, ^ CHECK: Alignment should match open parenthesis #647: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:553: +__weak u64 buddy_chunk_alloc(buddy_chunk_t __arg_arena *chunk, + int order_req) WARNING: line length of 86 exceeds 80 columns #655: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:561: + for (order = order_req; order < BUDDY_CHUNK_NUM_ORDERS && can_loop; order++) { ERROR: trailing whitespace #680: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:586: +^I/* $ ERROR: trailing whitespace #690: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:596: +^I^I * to be 0, so just add 1 << i). $ CHECK: Comparison to NULL could be written "chunk" #740: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:646: + for (chunk = buddy->first_chunk; chunk != NULL && can_loop; ERROR: trailing whitespace #766: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:672: +^I/* $ ERROR: trailing whitespace #813: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:719: +^I/* $ ERROR: trailing whitespace #815: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:721: +^I * For every coalescing step, keep the left buddy and $ ERROR: trailing whitespace #826: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:732: +^I^I/* $ WARNING: line length of 86 exceeds 80 columns #836: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:742: + /* Keep the left header out of the two buddies, drop the other one. */ WARNING: line length of 82 exceeds 80 columns #843: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:749: + /* Remove the buddy from the freelists so that we can merge it. */ ERROR: do not use assignment in if condition #867: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:773: + if ((ret = buddy_lock(buddy))) total: 24 errors, 42 warnings, 12 checks, 847 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. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile Commit afecc84cd9ad ("selftests/bpf: Add buddy allocator for libarena") has style problems, please review. NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE FILE_PATH_CHANGES 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.