Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH] ethernet: ice: avoid gcc-9 integer overflow warning | Date | Wed, 15 Feb 2023 10:58:46 +0000 |
| |
From: Arnd Bergmann > Sent: 14 February 2023 13:20 > > From: Arnd Bergmann <arnd@arndb.de> > > With older compilers like gcc-9, the calculation of the vlan > priority field causes a warning from the byteswap: > ... > > Fixes: 34800178b302 ("ice: Add support for VLAN priority filters in switchdev") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/net/ethernet/intel/ice/ice_tc_lib.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c > index 6b48cbc049c6..e9932446185c 100644 > --- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c > @@ -1453,10 +1453,9 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi, > } > > if (match.mask->vlan_priority) { > + u16 prio = (match.key->vlan_priority << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK; > fltr->flags |= ICE_TC_FLWR_FIELD_VLAN_PRIO; > - headers->vlan_hdr.vlan_prio = > - cpu_to_be16((match.key->vlan_priority << > - VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK); > + headers->vlan_hdr.vlan_prio = cpu_to_be16(prio); > }
Is there something that will do: unsigned int pri = match.key->vlan_priority & (VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT); headers->vlan_hdr.vlan_prio = pri << (VLAN_PRIO_SHIFT ^ (le ? 8 : 0));
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |