linux-stable/drivers/net/ethernet/intel
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
..
e1000 net: e1000: Remove unused declarations 2023-08-13 12:28:03 +01:00
e1000e e1000e: Use PME poll to circumvent unreliable ACPI wake 2023-08-16 12:22:22 +01:00
fm10k fm10k: Remove unnecessary aer.h include 2023-03-08 23:34:39 -08:00
i40e virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1 2023-08-16 09:05:04 -07:00
iavf virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1 2023-08-16 09:05:04 -07:00
ice virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1 2023-08-16 09:05:04 -07:00
igb net: flow_dissector: Use 64bits for used_keys 2023-07-31 09:11:24 +01:00
igbvf Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-03-24 10:10:20 -07:00
igc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-08-10 14:10:53 -07:00
ixgbe rtnetlink: remove redundant checks for nlattr IFLA_BRIDGE_MODE 2023-08-08 15:10:37 -07:00
ixgbevf ixgbevf: Remove unused function declarations 2023-08-04 18:03:00 -07:00
e100.c e100: Fix possible use after free in e100_xmit_prepare 2022-11-23 08:38:22 -08:00
Kconfig ixgb: Remove ixgb driver 2023-03-19 10:51:07 +00:00
Makefile ixgb: Remove ixgb driver 2023-03-19 10:51:07 +00:00