ipv6: exthdrs: use swap() instead of open coding it
Address the following coccicheck warning: net/ipv6/exthdrs.c:620:44-45: WARNING opportunity for swap() by using swap() for the swapping of variable values and drop the tmp (`addr`) variable that is not needed any more. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
816cda9ae5
Коммит
5ee6ad1dca
|
@ -487,7 +487,6 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb)
|
||||||
struct net *net = dev_net(skb->dev);
|
struct net *net = dev_net(skb->dev);
|
||||||
struct inet6_dev *idev;
|
struct inet6_dev *idev;
|
||||||
struct ipv6hdr *oldhdr;
|
struct ipv6hdr *oldhdr;
|
||||||
struct in6_addr addr;
|
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
int accept_rpl_seg;
|
int accept_rpl_seg;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
@ -616,9 +615,7 @@ looped_back:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = ipv6_hdr(skb)->daddr;
|
swap(ipv6_hdr(skb)->daddr, ohdr->rpl_segaddr[i]);
|
||||||
ipv6_hdr(skb)->daddr = ohdr->rpl_segaddr[i];
|
|
||||||
ohdr->rpl_segaddr[i] = addr;
|
|
||||||
|
|
||||||
ipv6_rpl_srh_compress(chdr, ohdr, &ipv6_hdr(skb)->daddr, n);
|
ipv6_rpl_srh_compress(chdr, ohdr, &ipv6_hdr(skb)->daddr, n);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче