mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
![]() With older compilers like gcc-9, the calculation of the vlan
priority field causes a false-positive warning from the byteswap:
In file included from drivers/net/ethernet/intel/ice/ice_tc_lib.c:4:
drivers/net/ethernet/intel/ice/ice_tc_lib.c: In function 'ice_parse_cls_flower':
include/uapi/linux/swab.h:15:15: error: integer overflow in expression '(int)(short unsigned int)((int)match.key-><U67c8>.<U6698>.vlan_priority << 13) & 57344 & 255' of type 'int' results in '0' [-Werror=overflow]
15 | (((__u16)(x) & (__u16)0x00ffU) << 8) | \
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
include/uapi/linux/swab.h:106:2: note: in expansion of macro '___constant_swab16'
106 | ___constant_swab16(x) : \
| ^~~~~~~~~~~~~~~~~~
include/uapi/linux/byteorder/little_endian.h:42:43: note: in expansion of macro '__swab16'
42 | #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
| ^~~~~~~~
include/linux/byteorder/generic.h:96:21: note: in expansion of macro '__cpu_to_be16'
96 | #define cpu_to_be16 __cpu_to_be16
| ^~~~~~~~~~~~~
drivers/net/ethernet/intel/ice/ice_tc_lib.c:1458:5: note: in expansion of macro 'cpu_to_be16'
1458 | cpu_to_be16((match.key->vlan_priority <<
| ^~~~~~~~~~~
After a change to be16_encode_bits(), the code becomes more
readable to both people and compilers, which avoids the warning.
Fixes:
|
||
---|---|---|
.. | ||
ice.h | ||
ice_adminq_cmd.h | ||
ice_arfs.c | ||
ice_arfs.h | ||
ice_base.c | ||
ice_base.h | ||
ice_cgu_regs.h | ||
ice_common.c | ||
ice_common.h | ||
ice_controlq.c | ||
ice_controlq.h | ||
ice_dcb.c | ||
ice_dcb.h | ||
ice_dcb_lib.c | ||
ice_dcb_lib.h | ||
ice_dcb_nl.c | ||
ice_dcb_nl.h | ||
ice_ddp.c | ||
ice_ddp.h | ||
ice_devids.h | ||
ice_devlink.c | ||
ice_devlink.h | ||
ice_eswitch.c | ||
ice_eswitch.h | ||
ice_ethtool.c | ||
ice_ethtool_fdir.c | ||
ice_fdir.c | ||
ice_fdir.h | ||
ice_flex_pipe.c | ||
ice_flex_pipe.h | ||
ice_flex_type.h | ||
ice_flow.c | ||
ice_flow.h | ||
ice_fltr.c | ||
ice_fltr.h | ||
ice_fw_update.c | ||
ice_fw_update.h | ||
ice_gnss.c | ||
ice_gnss.h | ||
ice_hw_autogen.h | ||
ice_idc.c | ||
ice_idc_int.h | ||
ice_lag.c | ||
ice_lag.h | ||
ice_lan_tx_rx.h | ||
ice_lib.c | ||
ice_lib.h | ||
ice_main.c | ||
ice_nvm.c | ||
ice_nvm.h | ||
ice_osdep.h | ||
ice_pf_vsi_vlan_ops.c | ||
ice_pf_vsi_vlan_ops.h | ||
ice_protocol_type.h | ||
ice_ptp.c | ||
ice_ptp.h | ||
ice_ptp_consts.h | ||
ice_ptp_hw.c | ||
ice_ptp_hw.h | ||
ice_repr.c | ||
ice_repr.h | ||
ice_sbq_cmd.h | ||
ice_sched.c | ||
ice_sched.h | ||
ice_sriov.c | ||
ice_sriov.h | ||
ice_switch.c | ||
ice_switch.h | ||
ice_tc_lib.c | ||
ice_tc_lib.h | ||
ice_trace.h | ||
ice_txrx.c | ||
ice_txrx.h | ||
ice_txrx_lib.c | ||
ice_txrx_lib.h | ||
ice_type.h | ||
ice_vf_lib.c | ||
ice_vf_lib.h | ||
ice_vf_lib_private.h | ||
ice_vf_mbx.c | ||
ice_vf_mbx.h | ||
ice_vf_vsi_vlan_ops.c | ||
ice_vf_vsi_vlan_ops.h | ||
ice_virtchnl.c | ||
ice_virtchnl.h | ||
ice_virtchnl_allowlist.c | ||
ice_virtchnl_allowlist.h | ||
ice_virtchnl_fdir.c | ||
ice_virtchnl_fdir.h | ||
ice_vlan.h | ||
ice_vlan_mode.c | ||
ice_vlan_mode.h | ||
ice_vsi_vlan_lib.c | ||
ice_vsi_vlan_lib.h | ||
ice_vsi_vlan_ops.c | ||
ice_vsi_vlan_ops.h | ||
ice_xsk.c | ||
ice_xsk.h | ||
Makefile |