On Fri, Nov 18, 2022 at 04:25:03AM +0530, Kumar Kartikeya Dwivedi wrote: > + > + if (reg->type == PTR_TO_MAP_VALUE) { > + rec = reg->map_ptr->record; > + } else /* PTR_TO_BTF_ID | MEM_ALLOC */ { > + struct btf_struct_meta *meta; > + > + meta = btf_find_struct_meta(reg->btf, reg->btf_id); > + if (!meta) { > + verbose(env, "bpf_list_head not found for allocated object\n"); > + return -EINVAL; > + } > + rec = meta->record; > + } > + ... > +static int process_kf_arg_ptr_to_list_node(struct bpf_verifier_env *env, > + struct bpf_reg_state *reg, u32 regno, > + struct bpf_kfunc_call_arg_meta *meta) > +{ ... > + > + struct_meta = btf_find_struct_meta(reg->btf, reg->btf_id); > + if (!struct_meta) { > + verbose(env, "bpf_list_node not found for allocated object\n"); > + return -EINVAL; > + } > + rec = struct_meta->record; and counting process_spin_lock() there are 3 cases of very similar code. Could you combine it into a helper?