On Wed, 2024-09-11 at 20:03 -0700, Eduard Zingerman wrote: [...] > Please bear with me. Here is btf_repeat_fields(): > > static int btf_repeat_fields(struct btf_field_info *info, > u32 field_cnt, u32 repeat_cnt, u32 elem_size) > { > u32 i, j; > u32 cur; > ... > cur = field_cnt; > for (i = 0; i < repeat_cnt; i++) { > ... > for (j = 0; j < field_cnt; j++) > info[cur++].off += (i + 1) * elem_size; > } > ... > } > > The range for 'cur' is [field_cnt .. field_cnt * repeat_cnt]. > Meaning that at-least 'field_cnt * repeat_cnt' entries are necessary > in the 'info' array. Ok, I'm wrong. The range for 'cur' is [field_cnt .. field_cnt * (repeat_cnt + 1)]. So with parameters passed maximal value of 'cur' is 'ret * nelems' indeed. Sorry for the noise.