summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/iavf/iavf_client.c
diff options
context:
space:
mode:
authorAlexander Lobakin <aleksander.lobakin@intel.com>2023-07-28 18:52:07 +0300
committerTony Nguyen <anthony.l.nguyen@intel.com>2023-08-16 19:14:14 +0300
commitb0654e64dbaf62f565b5f2b4fbd92202e88dcba3 (patch)
tree7b1eb8635e3d57e4f17bd3492f0a7865adf6e736 /drivers/net/ethernet/intel/iavf/iavf_client.c
parent5e7f59fa07f86f554c301c7a383bba54d5ef9819 (diff)
downloadlinux-b0654e64dbaf62f565b5f2b4fbd92202e88dcba3.tar.xz
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>
Diffstat (limited to 'drivers/net/ethernet/intel/iavf/iavf_client.c')
-rw-r--r--drivers/net/ethernet/intel/iavf/iavf_client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/iavf/iavf_client.c b/drivers/net/ethernet/intel/iavf/iavf_client.c
index 93c903c02c64..e6051b6355aa 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_client.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_client.c
@@ -469,8 +469,8 @@ static int iavf_client_setup_qvlist(struct iavf_info *ldev,
}
v_qvlist_info = (struct virtchnl_rdma_qvlist_info *)qvlist_info;
- msg_size = struct_size(v_qvlist_info, qv_info,
- v_qvlist_info->num_vectors - 1);
+ msg_size = virtchnl_struct_size(v_qvlist_info, qv_info,
+ v_qvlist_info->num_vectors);
adapter->client_pending |= BIT(VIRTCHNL_OP_CONFIG_RDMA_IRQ_MAP);
err = iavf_aq_send_msg_to_pf(&adapter->hw,