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: Please don't use multiple blank lines #134: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:40: + + CHECK: Lines should not end with a '(' #168: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:74: + bpf_arena_free_pages( CHECK: spaces preferred around that '*' (ctx:WxV) #224: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:130: +int idx_set_allocated(buddy_chunk_t __arg_arena *chunk, u64 idx, bool allocated) ^ WARNING: Possible repeated word: 'of' #227: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:133: + arena_stderr("setting state of of invalid idx (%d, max %d)\n", idx, WARNING: line length of 83 exceeds 80 columns #227: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:133: + arena_stderr("setting state of of invalid idx (%d, max %d)\n", idx, WARNING: line length of 82 exceeds 80 columns #243: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:149: + arena_stderr("getting state of invalid idx (%llu, max %d)\n", idx, CHECK: spaces preferred around that '*' (ctx:WxV) #253: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:159: +int idx_set_order(buddy_chunk_t __arg_arena *chunk, u64 idx, u8 order) ^ WARNING: line length of 81 exceeds 80 columns #345: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:251: + * to the header because of off-by-one errors when using adjacent blocks. WARNING: line length of 81 exceeds 80 columns #352: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:258: + * As a result, we have only two possible positions for the header: Bytes WARNING: line length of 84 exceeds 80 columns #353: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:259: + * 0 and 8. Keeping the header in byte 0 means off-by-ones from the previous WARNING: line length of 81 exceeds 80 columns #354: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:260: + * block touch the header, and, since the header must be accessible, ASAN WARNING: line length of 86 exceeds 80 columns #355: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:261: + * will not trigger. Keeping the header on byte 8 means off-by-one errors from WARNING: line length of 83 exceeds 80 columns #357: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:263: + * while accesses into the block from the next block are possible, they are CHECK: spaces preferred around that '*' (ctx:WxV) #434: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:340: +int add_leftovers_to_freelist(buddy_chunk_t __arg_arena *chunk, u32 cur_idx, ^ CHECK: Alignment should match open parenthesis #435: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:341: +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 #499: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:405: + * accidental deadlocks that will cause -ENOMEMs to the program as WARNING: line length of 82 exceeds 80 columns #500: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:406: + * the allocator fails to refill itself, in which case vaddr usage WARNING: line length of 87 exceeds 80 columns #503: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:409: + bpf_arena_free_pages(&arena, (void __arena *)vaddr, BUDDY_CHUNK_PAGES); WARNING: line length of 85 exceeds 80 columns #543: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:449: + * - Find the largest power-of-2 allocation still smaller than left (infimum) WARNING: please, no space before tabs #553: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:459: +^I * 0 ^I 64^I128^I^I 1 << 20$ WARNING: please, no space before tabs #557: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:463: +^I * ^I[0, 64)^I^I- Completely allocated$ WARNING: please, no space before tabs #558: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:464: +^I * ^I[64, 128)^I- Will be further split in the next iteration$ WARNING: please, no space before tabs #561: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:467: +^I * ^I[128, 256)$ WARNING: please, no space before tabs #562: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:468: +^I * ^I[256, 512)$ WARNING: please, no space before tabs #563: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:469: +^I * ^I...$ WARNING: please, no space before tabs #564: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:470: +^I * ^I[1 << 18, 1 << 19)$ WARNING: please, no space before tabs #565: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:471: +^I * ^I[1 << 19, 1 << 20)$ WARNING: please, no space before tabs #570: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:476: +^I * 64^I 80^I96^I^I ^I64 + 1 << 6 = 128$ WARNING: please, no space before tabs #574: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:480: +^I * ^I[64, 80)^I- Completely allocated$ WARNING: please, no space before tabs #578: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:484: +^I * ^I[96, 128)$ CHECK: Lines should not end with a '(' #593: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:499: + arena_stderr( CHECK: Lines should not end with a '(' #596: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:502: + arena_stderr( WARNING: line length of 95 exceeds 80 columns #607: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:513: + order = (power2 >= BUDDY_MIN_ALLOC_SHIFT) ? power2 - BUDDY_MIN_ALLOC_SHIFT : 0; WARNING: line length of 81 exceeds 80 columns #618: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:524: + * states by emitting a diagnostic in add_leftovers_to_freelist() WARNING: line length of 82 exceeds 80 columns #622: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:528: + if (add_leftovers_to_freelist(chunk, idx, min_order, max_order)) { CHECK: Alignment should match open parenthesis #638: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:544: +__hidden int buddy_init(struct buddy *buddy, + arena_spinlock_t __arg_arena __arena *lock) ERROR: do not use assignment in if condition #651: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:557: + if ((ret = buddy_reserve_arena_vaddr(buddy))) CHECK: spaces preferred around that '*' (ctx:WxV) #713: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:619: +__weak u64 buddy_chunk_alloc(buddy_chunk_t __arg_arena *chunk, ^ CHECK: Alignment should match open parenthesis #714: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:620: +__weak u64 buddy_chunk_alloc(buddy_chunk_t __arg_arena *chunk, + int order_req) WARNING: line length of 86 exceeds 80 columns #722: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:628: + for (order = order_req; order < BUDDY_CHUNK_NUM_ORDERS && can_loop; order++) { CHECK: Comparison to NULL could be written "chunk" #794: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:700: + for (chunk = buddy->first_chunk; chunk != NULL && can_loop; WARNING: line length of 91 exceeds 80 columns #808: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:714: +static u64 buddy_alloc_from_new_chunk(struct buddy *buddy, buddy_chunk_t *chunk, int order) CHECK: Please don't use multiple blank lines #815: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:721: + + CHECK: Please use a blank line after function/struct/union/enum declarations #830: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:736: +} +__weak WARNING: line length of 86 exceeds 80 columns #932: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:838: + /* Keep the left header out of the two buddies, drop the other one. */ WARNING: line length of 82 exceeds 80 columns #939: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:845: + /* Remove the buddy from the freelists so that we can merge it. */ ERROR: do not use assignment in if condition #963: FILE: tools/testing/selftests/bpf/libarena/src/buddy.bpf.c:869: + if ((ret = buddy_lock(buddy))) total: 3 errors, 46 warnings, 15 checks, 943 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 3193503a914b ("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.