Skip to content

Commit a613fb4

Browse files
plinga1anguy11
authored andcommitted
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: 0d7502a ("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>
1 parent fea7b71 commit a613fb4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/ethernet/intel/idpf/virtchnl2.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,9 @@ struct virtchnl2_rss_key {
11041104
__le32 vport_id;
11051105
__le16 key_len;
11061106
u8 pad;
1107-
__DECLARE_FLEX_ARRAY(u8, key_flex);
1108-
};
1109-
VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_rss_key);
1107+
u8 key_flex[];
1108+
} __packed;
1109+
VIRTCHNL2_CHECK_STRUCT_LEN(7, virtchnl2_rss_key);
11101110

11111111
/**
11121112
* struct virtchnl2_queue_chunk - chunk of contiguous queues

0 commit comments

Comments
 (0)