On Thu, 15 Feb 2024 at 02:11, Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > On Thu, 2024-02-01 at 04:20 +0000, Kumar Kartikeya Dwivedi wrote: > > Refactor check_pseudo_btf_id's code which adds a new BTF reference to > > the used_btfs into a separate helper function called add_used_btfs. This > > will be later useful in exception frame generation to take BTF > > references with their modules, so that we can keep the modules alive > > whose functions may be required to unwind a given BPF program when it > > eventually throws an exception. > > [...] > > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > > --- > > Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > > [...] > > > +static int add_used_btf(struct bpf_verifier_env *env, struct btf *btf) > > [...] > > > + if (env->used_btf_cnt >= MAX_USED_BTFS) { > > + err = -E2BIG; > > + goto err; > > Nit: could be "return -E2BIG" > Ack, will fix. > > + } > > + > > + btf_mod = &env->used_btfs[env->used_btf_cnt]; > > + btf_mod->btf = btf; > > + btf_mod->module = NULL; > > + > > + /* if we reference variables from kernel module, bump its refcount */ > > + if (btf_is_module(btf)) { > > + btf_mod->module = btf_try_get_module(btf); > > + if (!btf_mod->module) { > > + err = -ENXIO; > > + goto err; > > Nit: could be "return -ENXIO" > Ack.