Skip to content

Commit

Permalink
ipv6: ah6: use swap() to make code cleaner
Browse files Browse the repository at this point in the history
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yao Jing <yao.jing2@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yao Jing authored and David S. Miller committed Nov 18, 2021
1 parent df6160d commit 4cdf85e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/ipv6/ah6.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ static void ipv6_rearrange_destopt(struct ipv6hdr *iph, struct ipv6_opt_hdr *des
* See 11.3.2 of RFC 3775 for details.
*/
if (opt[off] == IPV6_TLV_HAO) {
struct in6_addr final_addr;
struct ipv6_destopt_hao *hao;

hao = (struct ipv6_destopt_hao *)&opt[off];
Expand All @@ -184,9 +183,7 @@ static void ipv6_rearrange_destopt(struct ipv6hdr *iph, struct ipv6_opt_hdr *des
hao->length);
goto bad;
}
final_addr = hao->addr;
hao->addr = iph->saddr;
iph->saddr = final_addr;
swap(hao->addr, iph->saddr);
}
break;
}
Expand Down

0 comments on commit 4cdf85e

Please sign in to comment.