virtchnl: fix fake 1-elem arrays for structures allocated as `nents`
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Fri, 28 Jul 2023 15:52:07 +0000 (17:52 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 16 Aug 2023 16:14:14 +0000 (09:14 -0700)
commitb0654e64dbaf62f565b5f2b4fbd92202e88dcba3
tree7b1eb8635e3d57e4f17bd3492f0a7865adf6e736
parent5e7f59fa07f86f554c301c7a383bba54d5ef9819
virtchnl: fix fake 1-elem arrays for structures allocated as `nents`

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@intel.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/iavf/iavf_client.c
drivers/net/ethernet/intel/iavf/iavf_client.h
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
include/linux/avf/virtchnl.h