net: bcmgenet: use __be16 for htons(ETH_P_IP)
authorDoug Berger <opendmb@gmail.com>
Thu, 25 Jun 2020 01:14:54 +0000 (18:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Jun 2020 04:51:03 +0000 (21:51 -0700)
The 16-bit value that holds a short in network byte order should
be declared as a restricted big endian type to allow type checks
to succeed during assignment.

Fixes: 3e370952287c ("net: bcmgenet: add support for ethtool rxnfc flows")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c

index f1fa116..c63f01e 100644 (file)
@@ -610,8 +610,9 @@ static int bcmgenet_hfb_create_rxnfc_filter(struct bcmgenet_priv *priv,
 {
        struct ethtool_rx_flow_spec *fs = &rule->fs;
        int err = 0, offset = 0, f_length = 0;
-       u16 val_16, mask_16;
        u8 val_8, mask_8;
+       __be16 val_16;
+       u16 mask_16;
        size_t size;
        u32 *f_data;