On Fri, Nov 04, 2022 at 12:39:55AM +0530, Kumar Kartikeya Dwivedi wrote: > - > - for (i = 0; i < nr_off; i++) { > + rec->cnt = 0; > + for (i = 0; i < cnt; i++) { > const struct btf_type *t; > s32 id; > > @@ -3500,28 +3499,24 @@ struct bpf_map_value_off *btf_parse_kptrs(const struct btf *btf, > ret = -EINVAL; > goto end_mod; > } > - tab->off[i].kptr.dtor = (void *)addr; > + rec->fields[i].kptr.dtor = (void *)addr; > } > > - tab->off[i].offset = info_arr[i].off; > - tab->off[i].type = info_arr[i].type; > - tab->off[i].kptr.btf_id = id; > - tab->off[i].kptr.btf = kernel_btf; > - tab->off[i].kptr.module = mod; > + rec->fields[i].offset = info_arr[i].off; > + rec->fields[i].type = info_arr[i].type; > + rec->fields[i].kptr.btf_id = id; > + rec->fields[i].kptr.btf = kernel_btf; > + rec->fields[i].kptr.module = mod; > + rec->cnt++; > } > - tab->nr_off = nr_off; > - return tab; > + rec->cnt = cnt; > + return rec; This is weird. You also undo this assignment in the next patch. What is the point of rec->cnt = 0; followed by rec->cnt++ just to be overwritten with rec->cnt = cnt; ??