On Fri, Feb 14, 2025 at 8:45 AM Amery Hung <ameryhung@xxxxxxxxx> wrote: > > > +int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog, > + const struct bpf_ctx_arg_aux *info, u32 cnt) > +{ > + prog->aux->ctx_arg_info = kcalloc(cnt, sizeof(*info), GFP_KERNEL); could have been kmalloc_array. > + if (!prog->aux->ctx_arg_info) > + return -ENOMEM; > + > + memcpy(prog->aux->ctx_arg_info, info, sizeof(*info) * cnt); Please use kmemdup(). Otherwise cocci fans will send a patch for this tomorrow. imo kmalloc+memcpy is fine, but, sigh, cocci. pw-bot: cr