linux-stable/drivers/net/ethernet/intel/i40e
Alexander Lobakin 5e7f59fa07 virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1
There are five virtchnl structures, which are allocated and checked in
the code as `nents + 1`, meaning that they always have memory for one
excessive element regardless of their actual number. This comes from
that their sizeof() includes space for 1 element and then they get
allocated via struct_size() or its open-coded equivalents, passing
the actual number of elements.
Expand virtchnl_struct_size() to handle such structures and replace
those 1-elem arrays with proper flex ones. Also fix several places
which open-code %IAVF_VIRTCHNL_VF_RESOURCE_SIZE. Finally, let the
virtchnl_ether_addr_list size be computed automatically when there's
no enough space for the whole list, otherwise we have to open-code
reverse struct_size() logics.

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>
2023-08-16 09:05:04 -07:00
..
i40e.h i40e: Remove unnecessary aer.h include 2023-03-08 23:34:39 -08:00
i40e_adminq.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_adminq.h i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_adminq_cmd.h i40e: allow toggling loopback mode via ndo_set_features callback 2022-12-12 15:24:47 -08:00
i40e_alloc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_client.c i40e: use ERR_PTR error print in i40e messages 2023-02-09 08:35:53 -08:00
i40e_common.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_dcb.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_dcb.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_dcb_nl.c i40e: use ERR_PTR error print in i40e messages 2023-02-09 08:35:53 -08:00
i40e_ddp.c i40e: Replace one-element array with flex-array member in struct i40e_package_header 2023-08-10 07:32:41 -07:00
i40e_debugfs.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_devids.h i40e: Add basic support for I710 devices 2022-09-06 12:49:00 -07:00
i40e_diag.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_diag.h i40e: fix registers dump after run ethtool adapter self test 2023-03-29 21:47:31 -07:00
i40e_ethtool.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_hmc.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_hmc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_lan_hmc.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_lan_hmc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_main.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_nvm.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_osdep.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_prototype.h i40e: Remove unused function declarations 2023-08-08 14:56:12 -07:00
i40e_ptp.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_register.h
i40e_trace.h i40e: add xdp_buff to i40e_ring struct 2023-03-09 13:11:24 -08:00
i40e_txrx.c i40e: xsk: add RX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_txrx.h i40e: xsk: add RX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_txrx_common.h
i40e_type.h i40e: Replace one-element array with flex-array member in struct i40e_profile_aq_section 2023-08-10 10:41:54 -07:00
i40e_virtchnl_pf.c virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1 2023-08-16 09:05:04 -07:00
i40e_virtchnl_pf.h virtchnl: i40e/iavf: rename iwarp to rdma 2023-01-25 08:55:19 -08:00
i40e_xsk.c i40e: xsk: add TX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_xsk.h i40e: Fix DMA mappings leak 2022-10-14 08:24:31 +01:00
Makefile