On Wed, 2024-10-09 at 15:12 +0800, Hou Tao wrote: [...] > I don't think they are the same. The main reason is due to the check in > the beginning of btf_repeat_field(): > > /* Ensure not repeating fields that should not be repeated. */ > for (i = 0; i < field_cnt; i++) { > switch (info[i].type) { > > There are two cases here: > 1) info_cnt == 0 > Because info_cnt is 0, the found record isn't saved in info[0], the > check will be incorrect > > 2) nelements ==1 && info_cnt > 0 > If the found record is bpf_timer or similar, btf_repeat_fields() will > return -EINVAL instead of 0. Oh, right, there is a loop accessing 'info' at the start. Sorry for the noise.