Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-dsa-warnings'

Andrew Lunn says:

====================
net: dsa: Fix C=1 W=1 warnings

Mostly not using __be16 when decoding packet contents.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+22 -17
+1 -1
net/dsa/dsa_priv.h
··· 77 77 struct sk_buff * (*xmit)(struct sk_buff *skb, 78 78 struct net_device *dev); 79 79 80 - struct pcpu_sw_netstats *stats64; 80 + struct pcpu_sw_netstats __percpu *stats64; 81 81 82 82 struct gro_cells gcells; 83 83
+5 -4
net/dsa/tag_ksz.c
··· 156 156 { 157 157 struct dsa_port *dp = dsa_slave_to_port(dev); 158 158 struct sk_buff *nskb; 159 - u16 *tag; 159 + __be16 *tag; 160 160 u8 *addr; 161 + u16 val; 161 162 162 163 nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN); 163 164 if (!nskb) ··· 168 167 tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN); 169 168 addr = skb_mac_header(nskb); 170 169 171 - *tag = BIT(dp->index); 170 + val = BIT(dp->index); 172 171 173 172 if (is_link_local_ether_addr(addr)) 174 - *tag |= KSZ9477_TAIL_TAG_OVERRIDE; 173 + val |= KSZ9477_TAIL_TAG_OVERRIDE; 175 174 176 - *tag = cpu_to_be16(*tag); 175 + *tag = cpu_to_be16(val); 177 176 178 177 return nskb; 179 178 }
+9 -8
net/dsa/tag_lan9303.c
··· 55 55 static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) 56 56 { 57 57 struct dsa_port *dp = dsa_slave_to_port(dev); 58 - u16 *lan9303_tag; 58 + __be16 *lan9303_tag; 59 + u16 tag; 59 60 60 61 /* insert a special VLAN tag between the MAC addresses 61 62 * and the current ethertype field. ··· 73 72 /* make room between MACs and Ether-Type */ 74 73 memmove(skb->data, skb->data + LAN9303_TAG_LEN, 2 * ETH_ALEN); 75 74 76 - lan9303_tag = (u16 *)(skb->data + 2 * ETH_ALEN); 75 + lan9303_tag = (__be16 *)(skb->data + 2 * ETH_ALEN); 76 + tag = lan9303_xmit_use_arl(dp, skb->data) ? 77 + LAN9303_TAG_TX_USE_ALR : 78 + dp->index | LAN9303_TAG_TX_STP_OVERRIDE; 77 79 lan9303_tag[0] = htons(ETH_P_8021Q); 78 - lan9303_tag[1] = lan9303_xmit_use_arl(dp, skb->data) ? 79 - LAN9303_TAG_TX_USE_ALR : 80 - dp->index | LAN9303_TAG_TX_STP_OVERRIDE; 81 - lan9303_tag[1] = htons(lan9303_tag[1]); 80 + lan9303_tag[1] = htons(tag); 82 81 83 82 return skb; 84 83 } ··· 86 85 static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, 87 86 struct packet_type *pt) 88 87 { 89 - u16 *lan9303_tag; 88 + __be16 *lan9303_tag; 90 89 u16 lan9303_tag1; 91 90 unsigned int source_port; 92 91 ··· 102 101 * ^ 103 102 * ->data 104 103 */ 105 - lan9303_tag = (u16 *)(skb->data - 2); 104 + lan9303_tag = (__be16 *)(skb->data - 2); 106 105 107 106 if (lan9303_tag[0] != htons(ETH_P_8021Q)) { 108 107 dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n");
+2 -1
net/dsa/tag_mtk.c
··· 67 67 static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, 68 68 struct packet_type *pt) 69 69 { 70 + u16 hdr; 70 71 int port; 71 - __be16 *phdr, hdr; 72 + __be16 *phdr; 72 73 unsigned char *dest = eth_hdr(skb)->h_dest; 73 74 bool is_multicast_skb = is_multicast_ether_addr(dest) && 74 75 !is_broadcast_ether_addr(dest);
+5 -3
net/dsa/tag_qca.c
··· 31 31 static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) 32 32 { 33 33 struct dsa_port *dp = dsa_slave_to_port(dev); 34 - u16 *phdr, hdr; 34 + __be16 *phdr; 35 + u16 hdr; 35 36 36 37 if (skb_cow_head(skb, QCA_HDR_LEN) < 0) 37 38 return NULL; ··· 40 39 skb_push(skb, QCA_HDR_LEN); 41 40 42 41 memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN); 43 - phdr = (u16 *)(skb->data + 2 * ETH_ALEN); 42 + phdr = (__be16 *)(skb->data + 2 * ETH_ALEN); 44 43 45 44 /* Set the version field, and set destination port information */ 46 45 hdr = QCA_HDR_VERSION << QCA_HDR_XMIT_VERSION_S | ··· 55 54 struct packet_type *pt) 56 55 { 57 56 u8 ver; 57 + u16 hdr; 58 58 int port; 59 - __be16 *phdr, hdr; 59 + __be16 *phdr; 60 60 61 61 if (unlikely(!pskb_may_pull(skb, QCA_HDR_LEN))) 62 62 return NULL;