WARNING: Improper SPDX comment style for 'tools/testing/selftests/bpf/libarena/include/buddy.h', please use '/*' instead #28: 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 #28: 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 #33: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:6: +typedef struct buddy_chunk __arena buddy_chunk_t; WARNING: do not add new typedefs #36: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:9: +typedef struct buddy_header __arena buddy_header_t; WARNING: line length of 84 exceeds 80 columns #59: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:32: + BUDDY_CHUNK_BYTES = BUDDY_MIN_ALLOC_BYTES << (BUDDY_CHUNK_NUM_ORDERS), WARNING: line length of 89 exceeds 80 columns #61: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:34: + /* Offset of the buddy header within a free block, see buddy.bpf.c for details */ WARNING: line length of 94 exceeds 80 columns #81: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:54: + u32 prev_index; /* "Pointer" to the previous available allocation of the same size. */ WARNING: line length of 87 exceeds 80 columns #102: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:75: + buddy_chunk_t *first_chunk; /* Pointer to the chunk linked list. */ WARNING: line length of 84 exceeds 80 columns #104: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:77: + u64 vaddr; /* Allocation into reserved vaddr */ WARNING: do not add new typedefs #107: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:80: +typedef struct buddy __arena buddy_t; WARNING: line length of 88 exceeds 80 columns #116: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:89: +#define buddy_alloc(alloc, size) ((void __arena *)buddy_alloc_internal((alloc), (size))) CHECK: Please don't use multiple blank lines #118: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:91: + + CHECK: Please don't use multiple blank lines #165: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:40: + + CHECK: Lines should not end with a '(' #203: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:78: + bpf_arena_free_pages( CHECK: spaces preferred around that '*' (ctx:WxV) #222: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:97: +__weak int buddy_alloc_arena_vaddr(buddy_t __arg_arena *buddy, u64 *vaddrp) ^ CHECK: spaces preferred around that '*' (ctx:WxV) #262: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:137: +int idx_set_allocated(buddy_chunk_t __arg_arena *chunk, u64 idx, bool allocated) ^ WARNING: line length of 81 exceeds 80 columns #267: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:142: + arena_stderr("setting state of invalid idx (%ld, max %d)\n", idx, CHECK: Alignment should match open parenthesis #275: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:150: + arena_stderr("Double %s of idx %ld for chunk %p", + allocated ? "alloc" : "free", WARNING: line length of 82 exceeds 80 columns #291: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:166: + arena_stderr("getting state of invalid idx (%llu, max %d)\n", idx, CHECK: spaces preferred around that '*' (ctx:WxV) #301: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:176: +int idx_set_order(buddy_chunk_t __arg_arena *chunk, u64 idx, u8 order) ^ WARNING: line length of 81 exceeds 80 columns #395: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:270: + * to the header because of off-by-one errors when using adjacent blocks. WARNING: line length of 81 exceeds 80 columns #402: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:277: + * As a result, we have only two possible positions for the header: Bytes WARNING: line length of 84 exceeds 80 columns #403: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:278: + * 0 and 8. Keeping the header in byte 0 means off-by-ones from the previous WARNING: line length of 81 exceeds 80 columns #404: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:279: + * block touch the header, and, since the header must be accessible, ASAN WARNING: line length of 86 exceeds 80 columns #405: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:280: + * will not trigger. Keeping the header on byte 8 means off-by-one errors from WARNING: line length of 83 exceeds 80 columns #407: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:282: + * while accesses into the block from the next block are possible, they are CHECK: Alignment should match open parenthesis #415: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:290: +static void header_add_freelist(buddy_chunk_t *chunk, buddy_header_t *header, + u64 idx, u8 order) CHECK: spaces preferred around that '*' (ctx:WxV) #484: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:359: +int add_leftovers_to_freelist(buddy_chunk_t __arg_arena *chunk, u32 cur_idx, ^ CHECK: Alignment should match open parenthesis #485: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:360: +int add_leftovers_to_freelist(buddy_chunk_t __arg_arena *chunk, u32 cur_idx, + u64 min_order, u64 max_order) WARNING: line length of 82 exceeds 80 columns #548: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:423: + * accidental deadlocks that will cause -ENOMEMs to the program as WARNING: line length of 82 exceeds 80 columns #549: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:424: + * the allocator fails to refill itself, in which case vaddr usage WARNING: line length of 87 exceeds 80 columns #552: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:427: + bpf_arena_free_pages(&arena, (void __arena *)vaddr, BUDDY_CHUNK_PAGES); WARNING: line length of 85 exceeds 80 columns #592: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:467: + * - Find the largest power-of-2 allocation still smaller than left (infimum) WARNING: please, no space before tabs #606: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:481: +^I * ^I[0, 64) - Completely allocated$ WARNING: please, no space before tabs #607: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:482: +^I * ^I[64, 128) - Will be further split in the next iteration$ WARNING: please, no space before tabs #610: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:485: +^I * ^I[128, 256)$ WARNING: please, no space before tabs #611: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:486: +^I * ^I[256, 512)$ WARNING: please, no space before tabs #612: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:487: +^I * ^I...$ WARNING: please, no space before tabs #613: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:488: +^I * ^I[1 << 18, 1 << 19)$ WARNING: please, no space before tabs #614: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:489: +^I * ^I[1 << 19, 1 << 20)$ WARNING: please, no space before tabs #619: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:494: +^I * 64^I 80^I96^I^I ^I64 + 1 << 6 = 128$ WARNING: please, no space before tabs #623: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:498: +^I * ^I[64, 80)^I- Completely allocated$ WARNING: please, no space before tabs #627: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:502: +^I * ^I[96, 128)$ CHECK: Lines should not end with a '(' #642: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:517: + arena_stderr( CHECK: Lines should not end with a '(' #645: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:520: + arena_stderr( WARNING: line length of 95 exceeds 80 columns #656: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:531: + order = (power2 >= BUDDY_MIN_ALLOC_SHIFT) ? power2 - BUDDY_MIN_ALLOC_SHIFT : 0; WARNING: line length of 81 exceeds 80 columns #670: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:545: + * states by emitting a diagnostic in add_leftovers_to_freelist() WARNING: line length of 82 exceeds 80 columns #674: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:549: + if (add_leftovers_to_freelist(chunk, idx, min_order, max_order)) { CHECK: spaces preferred around that '*' (ctx:WxV) #689: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:564: +__weak int buddy_init(buddy_t __arg_arena *buddy) ^ CHECK: spaces preferred around that '*' (ctx:WxV) #730: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:605: +__weak int buddy_destroy(buddy_t __arg_arena *buddy) ^ CHECK: spaces preferred around that '*' (ctx:WxV) #759: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:634: +__weak u64 buddy_chunk_alloc(buddy_chunk_t __arg_arena *chunk, int order_req) ^ WARNING: line length of 86 exceeds 80 columns #767: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:642: + for (order = order_req; order < BUDDY_CHUNK_NUM_ORDERS && can_loop; order++) { CHECK: No space is necessary after a cast #778: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:653: + return (u64) NULL; CHECK: Comparison to NULL could be written "chunk" #842: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:717: + for (chunk = buddy->first_chunk; chunk != NULL && can_loop; WARNING: line length of 86 exceeds 80 columns #856: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:731: +static u64 buddy_alloc_from_new_chunk(buddy_t *buddy, buddy_chunk_t *chunk, int order) CHECK: Please don't use multiple blank lines #863: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:738: + + CHECK: Please use a blank line after function/struct/union/enum declarations #877: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:752: +} +__weak CHECK: spaces preferred around that '*' (ctx:WxV) #878: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:753: +u64 buddy_alloc_internal(buddy_t __arg_arena *buddy, size_t size) ^ WARNING: line length of 86 exceeds 80 columns #982: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:857: + /* Keep the left header out of the two buddies, drop the other one. */ WARNING: line length of 82 exceeds 80 columns #989: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:864: + /* Remove the buddy from the freelists so that we can merge it. */ CHECK: spaces preferred around that '*' (ctx:WxV) #1006: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:881: +__weak int buddy_free_internal(buddy_t __arg_arena *buddy, u64 addr) ^ total: 0 errors, 40 warnings, 21 checks, 1020 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 8c23365116ec ("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. total: 0 errors, 40 warnings, 21 checks, 1020 lines checked