Skip to contentSkip to conversation

ipv6: exthdrs: use swap macro in ipv6_dest_hao

PATCH Applied Gustavo A. R. Silva 2 participants 3 messages Oct 27, 2017 – Oct 28, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: exthdrs: use swap macro in ipv6_dest_hao

make use of the swap macro and remove unnecessary variable tmp_addr. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
 net/ipv6/exthdrs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv6/exthdrs.c +1 -4
index 7835dea..9f918a7 100644
@@ -187,7 +187,6 @@ static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
 	struct ipv6_destopt_hao *hao;
 	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
-	struct in6_addr tmp_addr;
 	int ret;
 
 	if (opt->dsthao) {
@@ -229,9 +228,7 @@ static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
 	if (skb->ip_summed == CHECKSUM_COMPLETE)
 		skb->ip_summed = CHECKSUM_NONE;
 
-	tmp_addr = ipv6h->saddr;
-	ipv6h->saddr = hao->addr;
-	hao->addr = tmp_addr;
+	swap(ipv6h->saddr, hao->addr);
 
 	if (skb->tstamp == 0)
 		__net_timestamp(skb);
Signature · 1 line
2.7.4
Applied
#1 lore raw

From: "Gustavo A. R. Silva" <[email protected]>
Date: Thu, 26 Oct 2017 23:10:35 -0500

Quoted 6 lines

make use of the swap macro and remove unnecessary variable tmp_addr. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Applied to net-next, thanks.

#2 lore raw

Quoting David Miller <[email protected]>:

Quoted 11 lines

From: "Gustavo A. R. Silva" <[email protected]>
Date: Thu, 26 Oct 2017 23:10:35 -0500

Quoted 6 lines

make use of the swap macro and remove unnecessary variable tmp_addr. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Applied to net-next, thanks.

Glad to help.

Thanks
--
Gustavo A. R. Silva