[Intel-wired-lan] [PATCH net-next v1] ice: refactor to remove not needed packing

Jesse Brandeburg jesse.brandeburg at intel.com
Thu Mar 30 19:18:13 UTC 2023


After the changes to the structures to make them flex array safe,
packing is no longer necessary.

to reproduce:
make EXTRA_CFLAGS=-Wpacked drivers/net/ethernet/intel/ice/ice.ko

In file included from drivers/net/ethernet/intel/ice/ice_controlq.h:7,
                 from drivers/net/ethernet/intel/ice/ice_type.h:14,
                 from drivers/net/ethernet/intel/ice/ice.h:59:
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:618:1: warning: packed attribute is unnecessary for ‘ice_aqc_sw_rules_elem_hdr’ [-Wpacked]
  618 | } __packed __aligned(sizeof(__le16));
      | ^
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:705:1: warning: packed attribute is unnecessary for ‘ice_sw_rule_lkup_rx_tx’ [-Wpacked]
  705 | } __packed __aligned(sizeof(__le16));
      | ^
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:767:1: warning: packed attribute is unnecessary for ‘ice_sw_rule_lg_act’ [-Wpacked]
  767 | } __packed __aligned(sizeof(__le16));
      | ^
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:779:1: warning: packed attribute is unnecessary for ‘ice_sw_rule_vsi_list’ [-Wpacked]
  779 | } __packed __aligned(sizeof(__le16));
      | ^

Fixes: 6e1ff618737a ("ice: fix access-beyond-end in the switch code")
Signed-off-by: Jesse Brandeburg <jesse.brandeburg at intel.com>
---
 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index 838d9b274d68..7460dcaf6473 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -615,7 +615,7 @@ struct ice_aqc_sw_rules_elem_hdr {
 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET	0x5
 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR	0x6
 	__le16 status;
-} __packed __aligned(sizeof(__le16));
+} __aligned(sizeof(__le16));
 
 /* Add/Update/Get/Remove lookup Rx/Tx command/response entry
  * This structures describes the lookup rules and associated actions. "index"
@@ -702,7 +702,7 @@ struct ice_sw_rule_lkup_rx_tx {
 	 */
 	__le16 hdr_len;
 	u8 hdr_data[];
-} __packed __aligned(sizeof(__le16));
+} __aligned(sizeof(__le16));
 
 /* Add/Update/Remove large action command/response entry
  * "index" is returned as part of a response to a successful Add command, and
@@ -764,7 +764,7 @@ struct ice_sw_rule_lg_act {
 #define ICE_LG_ACT_STAT_COUNT_S		3
 #define ICE_LG_ACT_STAT_COUNT_M		(0x7F << ICE_LG_ACT_STAT_COUNT_S)
 	__le32 act[]; /* array of size for actions */
-} __packed __aligned(sizeof(__le16));
+} __aligned(sizeof(__le16));
 
 /* Add/Update/Remove VSI list command/response entry
  * "index" is returned as part of a response to a successful Add command, and
@@ -776,7 +776,7 @@ struct ice_sw_rule_vsi_list {
 	__le16 index; /* Index of VSI/Prune list */
 	__le16 number_vsi;
 	__le16 vsi[]; /* Array of number_vsi VSI numbers */
-} __packed __aligned(sizeof(__le16));
+} __aligned(sizeof(__le16));
 
 /* Query PFC Mode (direct 0x0302)
  * Set PFC Mode (direct 0x0303)
-- 
2.39.2



More information about the Intel-wired-lan mailing list