Re: [PATCH net-next 3/3] virtchnl: fix fake 1-elem arrays for structures allocated as `nents`

From: Kees Cook
Date: Fri Aug 04 2023 - 04:30:54 EST


On Fri, Jul 28, 2023 at 05:52:07PM +0200, Alexander Lobakin wrote:
> Finally, fix 3 structures which are allocated technically correctly,
> i.e. the calculated size equals to the one that struct_size() would
> return, except for sizeof(). For &virtchnl_vlan_filter_list_v2, use
> the same approach when there are no enough space as taken previously
> for &virtchnl_vlan_filter_list, i.e. let the maximum size be calculated
> automatically instead of trying to guestimate it using maths.
>
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook