idpf: avoid compiler introduced padding in virtchnl2_rss_key struct
authorPavan Kumar Linga <pavan.kumar.linga@intel.com>
Fri, 15 Dec 2023 23:48:07 +0000 (15:48 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 26 Dec 2023 17:05:57 +0000 (09:05 -0800)
commita613fb464dc4d8902d1dbca836a0872a80d36296
treeaeaa6f5fc35dc8e1b3ceb6b3d1a7cb22e2eb6b6e
parentfea7b71b8751a0bfa7fdf9977e5782f061f71589
idpf: avoid compiler introduced padding in virtchnl2_rss_key struct

Size of the virtchnl2_rss_key struct should be 7 bytes but the
compiler introduces a padding byte for the structure alignment.
This results in idpf sending an additional byte of memory to the device
control plane than the expected buffer size. As the control plane
enforces virtchnl message size checks to validate the message,
set RSS key message fails resulting in the driver load failure.

Remove implicit compiler padding by using "__packed" structure
attribute for the virtchnl2_rss_key struct.

Also there is no need to use __DECLARE_FLEX_ARRAY macro for the
'key_flex' struct field. So drop it.

Fixes: 0d7502a9b4a7 ("virtchnl: add virtchnl version 2 ops")
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Scott Register <scott.register@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/virtchnl2.h