WARNING: Improper SPDX comment style for 'tools/testing/selftests/bpf/libarena/include/buddy.h', please use '/*' instead #44: 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 #44: 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 #49: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:6: +typedef struct buddy_chunk __arena buddy_chunk_t; WARNING: do not add new typedefs #52: 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 #75: 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 #77: 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 #97: 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 #118: 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 #120: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:77: + u64 vaddr; /* Allocation into reserved vaddr */ WARNING: do not add new typedefs #123: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:80: +typedef struct buddy __arena buddy_t; WARNING: line length of 88 exceeds 80 columns #132: 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 #134: FILE: tools/testing/selftests/bpf/libarena/include/buddy.h:91: + + CHECK: spaces preferred around that '*' (ctx:WxV) #146: FILE: tools/testing/selftests/bpf/libarena/include/common.h:47: +void free(void __arena *ptr); ^ WARNING: Single statement macros should not use a do {} while (0) loop #156: FILE: tools/testing/selftests/bpf/libarena/include/common.h:57: +#define arena_subprog_init() do { asm volatile ("" :: "r"(&arena)); } while (0) CHECK: Please don't use multiple blank lines #218: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:40: + + CHECK: Lines should not end with a '(' #256: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:78: + bpf_arena_free_pages( CHECK: spaces preferred around that '*' (ctx:WxV) #275: 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) #315: 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 #320: 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 #328: 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 #344: 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) #354: 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 #448: 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 #455: 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 #456: 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 #457: 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 #458: 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 #460: 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 #468: 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) #537: 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 #538: 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 #601: 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 #602: 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 #605: 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 #645: 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 #659: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:481: +^I * ^I[0, 64) - Completely allocated$ WARNING: please, no space before tabs #660: 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 #663: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:485: +^I * ^I[128, 256)$ WARNING: please, no space before tabs #664: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:486: +^I * ^I[256, 512)$ WARNING: please, no space before tabs #665: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:487: +^I * ^I...$ WARNING: please, no space before tabs #666: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:488: +^I * ^I[1 << 18, 1 << 19)$ WARNING: please, no space before tabs #667: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:489: +^I * ^I[1 << 19, 1 << 20)$ WARNING: please, no space before tabs #672: 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 #676: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:498: +^I * ^I[64, 80)^I- Completely allocated$ WARNING: please, no space before tabs #680: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:502: +^I * ^I[96, 128)$ CHECK: Lines should not end with a '(' #695: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:517: + arena_stderr( CHECK: Lines should not end with a '(' #698: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:520: + arena_stderr( WARNING: line length of 95 exceeds 80 columns #709: 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 #723: 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 #727: 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) #742: 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) #783: 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) #812: 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 #820: 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 #831: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:653: + return (u64) NULL; CHECK: Comparison to NULL could be written "chunk" #895: 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 #909: 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 #916: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:738: + + CHECK: Please use a blank line after function/struct/union/enum declarations #930: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:752: +} +__weak CHECK: spaces preferred around that '*' (ctx:WxV) #931: 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 #1035: 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 #1042: 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) #1059: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:881: +__weak int buddy_free_internal(buddy_t __arg_arena *buddy, u64 addr) ^ CHECK: Please don't use multiple blank lines #1124: FILE: tools/testing/selftests/bpf/libarena/src/common.bpf.c:86: + + total: 0 errors, 41 warnings, 23 checks, 1068 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 801fc5582857 ("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, 41 warnings, 23 checks, 1068 lines checked