CHECK: Alignment should match open parenthesis #86: FILE: kernel/bpf/bpf_iter.c:780: +BPF_CALL_4(bpf_loop_termination, u32, nr_loops, void *, callback_fn, + void *, callback_ctx, u64, flags) CHECK: Lines should not end with a '(' #99: FILE: kernel/bpf/bpf_iter.c:793: + asm volatile( WARNING: please, no spaces at the start of a line #110: FILE: kernel/bpf/bpf_iter.c:804: + .func = bpf_loop_termination,$ WARNING: please, no spaces at the start of a line #111: FILE: kernel/bpf/bpf_iter.c:805: + .gpl_only = false,$ WARNING: please, no spaces at the start of a line #112: FILE: kernel/bpf/bpf_iter.c:806: + .ret_type = RET_INTEGER,$ WARNING: please, no spaces at the start of a line #113: FILE: kernel/bpf/bpf_iter.c:807: + .arg1_type = ARG_ANYTHING,$ WARNING: please, no spaces at the start of a line #114: FILE: kernel/bpf/bpf_iter.c:808: + .arg2_type = ARG_PTR_TO_FUNC,$ WARNING: please, no spaces at the start of a line #115: FILE: kernel/bpf/bpf_iter.c:809: + .arg3_type = ARG_PTR_TO_STACK_OR_NULL,$ WARNING: please, no spaces at the start of a line #116: FILE: kernel/bpf/bpf_iter.c:810: + .arg4_type = ARG_ANYTHING,$ WARNING: Argument 'prog_ctx_type' is not used in function-like macro #209: FILE: kernel/bpf/syscall.c:56: +#define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \ + [_id] = & _name ## _verifier_ops, WARNING: Argument 'kern_ctx_type' is not used in function-like macro #209: FILE: kernel/bpf/syscall.c:56: +#define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \ + [_id] = & _name ## _verifier_ops, ERROR: space prohibited after that '&' (ctx:WxW) #210: FILE: kernel/bpf/syscall.c:57: + [_id] = & _name ## _verifier_ops, ^ WARNING: Argument '_id' is not used in function-like macro #211: FILE: kernel/bpf/syscall.c:58: +#define BPF_MAP_TYPE(_id, _ops) WARNING: Argument '_ops' is not used in function-like macro #211: FILE: kernel/bpf/syscall.c:58: +#define BPF_MAP_TYPE(_id, _ops) WARNING: Argument '_id' is not used in function-like macro #212: FILE: kernel/bpf/syscall.c:59: +#define BPF_LINK_TYPE(_id, _name) WARNING: Argument '_name' is not used in function-like macro #212: FILE: kernel/bpf/syscall.c:59: +#define BPF_LINK_TYPE(_id, _name) WARNING: Missing a blank line after declarations #229: FILE: kernel/bpf/syscall.c:2774: + int err = 0; + patch_prog->expected_attach_type = prog->expected_attach_type; WARNING: Missing a blank line after declarations #240: FILE: kernel/bpf/syscall.c:2785: + char *patch_prefix = "patch_"; + strncpy(patch_prog->aux->name, patch_prefix, strlen(patch_prefix)); WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90 #240: FILE: kernel/bpf/syscall.c:2785: + strncpy(patch_prog->aux->name, patch_prefix, strlen(patch_prefix)); WARNING: line length of 81 exceeds 80 columns #241: FILE: kernel/bpf/syscall.c:2786: + strncat(patch_prog->aux->name, prog->aux->name, sizeof(prog->aux->name)); ERROR: open brace '{' following function definitions go on the next line #246: FILE: kernel/bpf/syscall.c:2791: +static bool is_verifier_inlined_function(int func_id) { ERROR: switch and case should be at the same indent #247: FILE: kernel/bpf/syscall.c:2792: + switch (func_id) { + case BPF_FUNC_get_smp_processor_id: + case BPF_FUNC_jiffies64: + case BPF_FUNC_get_func_arg: + case BPF_FUNC_get_func_ret: + case BPF_FUNC_get_func_arg_cnt: + case BPF_FUNC_get_func_ip: + case BPF_FUNC_get_branch_snapshot: + case BPF_FUNC_kptr_xchg: + case BPF_FUNC_map_lookup_elem: [...] + default: ERROR: open brace '{' following function definitions go on the next line #263: FILE: kernel/bpf/syscall.c:2808: +static bool is_debug_function(int func_id) { ERROR: switch and case should be at the same indent #264: FILE: kernel/bpf/syscall.c:2809: + switch (func_id) { + case BPF_FUNC_trace_printk: [...] + default: ERROR: open brace '{' following function definitions go on the next line #272: FILE: kernel/bpf/syscall.c:2817: +static bool is_resource_release_function(int func_id) { ERROR: switch and case should be at the same indent #273: FILE: kernel/bpf/syscall.c:2818: + switch (func_id) { + case BPF_FUNC_spin_unlock: + case BPF_FUNC_ringbuf_submit: + case BPF_FUNC_ringbuf_discard: [...] + default: ERROR: open brace '{' following function definitions go on the next line #283: FILE: kernel/bpf/syscall.c:2828: +static bool find_in_skiplist(int func_id) { ERROR: open brace '{' following function definitions go on the next line #289: FILE: kernel/bpf/syscall.c:2834: +static int get_replacement_helper(int func_id, enum bpf_return_type ret_type) { CHECK: Blank lines aren't necessary after an open brace '{' #290: FILE: kernel/bpf/syscall.c:2835: +static int get_replacement_helper(int func_id, enum bpf_return_type ret_type) { + ERROR: switch and case should be at the same indent #291: FILE: kernel/bpf/syscall.c:2836: + switch (func_id) { + case BPF_FUNC_loop: [...] + case BPF_FUNC_for_each_map_elem: + case BPF_FUNC_user_ringbuf_drain: WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #296: FILE: kernel/bpf/syscall.c:2841: + return -ENOTSUPP; ERROR: switch and case should be at the same indent #299: FILE: kernel/bpf/syscall.c:2844: + switch (ret_type) { + case RET_VOID: [...] + case RET_INTEGER: [...] + case RET_PTR_TO_MAP_VALUE_OR_NULL: [...] + case RET_PTR_TO_SOCKET_OR_NULL: + case RET_PTR_TO_TCP_SOCK_OR_NULL: + case RET_PTR_TO_SOCK_COMMON_OR_NULL: + case RET_PTR_TO_RINGBUF_MEM_OR_NULL: + case RET_PTR_TO_DYNPTR_MEM_OR_NULL: + case RET_PTR_TO_BTF_ID_OR_NULL: + case RET_PTR_TO_BTF_ID_TRUSTED: + case RET_PTR_TO_MAP_VALUE: + case RET_PTR_TO_SOCKET: + case RET_PTR_TO_TCP_SOCK: + case RET_PTR_TO_SOCK_COMMON: + case RET_PTR_TO_MEM: + case RET_PTR_TO_MEM_OR_BTF_ID: + case RET_PTR_TO_BTF_ID: + default: WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #321: FILE: kernel/bpf/syscall.c:2866: + return -ENOTSUPP; WARNING: missing space after struct definition #327: FILE: kernel/bpf/syscall.c:2872: + struct call_insn_aux{ ERROR: spaces required around that '=' (ctx:VxV) #333: FILE: kernel/bpf/syscall.c:2878: + int num_calls=0; ^ WARNING: Missing a blank line after declarations #334: FILE: kernel/bpf/syscall.c:2879: + int num_calls=0; + call_indices = vmalloc(sizeof(call_indices) * prog->len); ERROR: that open brace { should be on the previous line #337: FILE: kernel/bpf/syscall.c:2882: + for(int insn_idx =0 ;insn_idx < prog->len; insn_idx++) + { ERROR: spaces required around that '=' (ctx:WxV) #337: FILE: kernel/bpf/syscall.c:2882: + for(int insn_idx =0 ;insn_idx < prog->len; insn_idx++) ^ ERROR: space required after that ';' (ctx:WxV) #337: FILE: kernel/bpf/syscall.c:2882: + for(int insn_idx =0 ;insn_idx < prog->len; insn_idx++) ^ ERROR: space required before the open parenthesis '(' #337: FILE: kernel/bpf/syscall.c:2882: + for(int insn_idx =0 ;insn_idx < prog->len; insn_idx++) WARNING: space prohibited before semicolon #339: FILE: kernel/bpf/syscall.c:2884: + struct bpf_insn *insn = &prog->insnsi[insn_idx] ; WARNING: Missing a blank line after declarations #341: FILE: kernel/bpf/syscall.c:2886: + u8 class = BPF_CLASS(insn->code); + if (class == BPF_JMP || class == BPF_JMP32) { ERROR: space required before the open brace '{' #342: FILE: kernel/bpf/syscall.c:2887: + if (BPF_OP(insn->code) == BPF_CALL){ WARNING: braces {} are not necessary for single statement blocks #343: FILE: kernel/bpf/syscall.c:2888: + if (insn->src_reg == BPF_PSEUDO_CALL) { + continue; + } WARNING: line length of 87 exceeds 80 columns #346: FILE: kernel/bpf/syscall.c:2891: + if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL){ /*kfunc */ ERROR: space required before the open brace '{' #346: FILE: kernel/bpf/syscall.c:2891: + if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL){ /*kfunc */ WARNING: line length of 81 exceeds 80 columns #347: FILE: kernel/bpf/syscall.c:2892: + // TODO Need to use btf for getting proto WARNING: line length of 99 exceeds 80 columns #349: FILE: kernel/bpf/syscall.c:2894: + // If acquire function --> find return type and add to list ERROR: else should follow close brace '}' #351: FILE: kernel/bpf/syscall.c:2896: + } + else { CHECK: Unbalanced braces around else statement #351: FILE: kernel/bpf/syscall.c:2896: + else { WARNING: braces {} are not necessary for single statement blocks #356: FILE: kernel/bpf/syscall.c:2901: + if (find_in_skiplist(func_id)) { + continue; + } WARNING: line length of 105 exceeds 80 columns #360: FILE: kernel/bpf/syscall.c:2905: + fn = bpf_verifier_ops[prog->type]->get_func_proto(func_id, prog); WARNING: braces {} are not necessary for single statement blocks #361: FILE: kernel/bpf/syscall.c:2906: + if (!fn && !fn->func) { + continue; + } WARNING: line length of 102 exceeds 80 columns #365: FILE: kernel/bpf/syscall.c:2910: + new_helper_id = get_replacement_helper(func_id, fn->ret_type); WARNING: braces {} are not necessary for single statement blocks #366: FILE: kernel/bpf/syscall.c:2911: + if (new_helper_id < 0) { + continue; + } WARNING: line length of 84 exceeds 80 columns #370: FILE: kernel/bpf/syscall.c:2915: + call_indices[num_calls].insn_idx = insn_idx; WARNING: line length of 98 exceeds 80 columns #371: FILE: kernel/bpf/syscall.c:2916: + call_indices[num_calls].replacement_helper= new_helper_id; ERROR: spaces required around that '=' (ctx:VxW) #371: FILE: kernel/bpf/syscall.c:2916: + call_indices[num_calls].replacement_helper= new_helper_id; ^ ERROR: spaces required around that '=' (ctx:WxV) #379: FILE: kernel/bpf/syscall.c:2924: + for(int k =0; k < num_calls; k++){ ^ ERROR: space required before the open brace '{' #379: FILE: kernel/bpf/syscall.c:2924: + for(int k =0; k < num_calls; k++){ ERROR: space required before the open parenthesis '(' #379: FILE: kernel/bpf/syscall.c:2924: + for(int k =0; k < num_calls; k++){ WARNING: braces {} are not necessary for single statement blocks #379: FILE: kernel/bpf/syscall.c:2924: + for(int k =0; k < num_calls; k++){ + prog->insnsi[call_indices[k].insn_idx].imm = call_indices[k].replacement_helper; + } WARNING: line length of 96 exceeds 80 columns #380: FILE: kernel/bpf/syscall.c:2925: + prog->insnsi[call_indices[k].insn_idx].imm = call_indices[k].replacement_helper; CHECK: Alignment should match open parenthesis #385: FILE: kernel/bpf/syscall.c:2930: +static bool create_termination_prog(struct bpf_prog *prog, + union bpf_attr *attr, WARNING: Missing a blank line after declarations #394: FILE: kernel/bpf/syscall.c:2939: + struct bpf_prog *patch_prog; + patch_prog = bpf_prog_alloc_no_stats(bpf_prog_size(prog->len), 0); WARNING: braces {} are not necessary for single statement blocks #395: FILE: kernel/bpf/syscall.c:2940: + if (!patch_prog) { + return false; + } WARNING: suspect code indent for conditional statements (8, 24) #402: FILE: kernel/bpf/syscall.c:2947: + if (err) + goto free_termination_prog; WARNING: braces {} are not necessary for single statement blocks #408: FILE: kernel/bpf/syscall.c:2953: + if (err) { + goto free_termination_prog; + } WARNING: braces {} are not necessary for single statement blocks #413: FILE: kernel/bpf/syscall.c:2958: + if (err) { + goto free_termination_prog; + } WARNING: line length of 88 exceeds 80 columns #442: FILE: kernel/bpf/syscall.c:3184: + have_termination_prog = create_termination_prog( prog, attr, uattr, uattr_size); ERROR: space prohibited after that open parenthesis '(' #442: FILE: kernel/bpf/syscall.c:3184: + have_termination_prog = create_termination_prog( prog, attr, uattr, uattr_size); CHECK: Logical continuations should be on the previous line #502: FILE: kernel/bpf/verifier.c:22550: + (insn->imm == BPF_FUNC_loop + || insn->imm == BPF_FUNC_loop_termination); total: 24 errors, 42 warnings, 6 checks, 432 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 7d5b10d167eb ("bpf: Generating a stubbed version of BPF program for termination") 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.