Re: [RESEND][PATCH bpf 1/2] bpf: Check the remaining info_cnt before repeating btf fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux