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

ipv6: ah6: use swap() to make code cleaner

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>

authored by

Yao Jing and committed by
David S. Miller
4cdf85ef df6160de

+1 -4
+1 -4
net/ipv6/ah6.c
··· 175 175 * See 11.3.2 of RFC 3775 for details. 176 176 */ 177 177 if (opt[off] == IPV6_TLV_HAO) { 178 - struct in6_addr final_addr; 179 178 struct ipv6_destopt_hao *hao; 180 179 181 180 hao = (struct ipv6_destopt_hao *)&opt[off]; ··· 183 184 hao->length); 184 185 goto bad; 185 186 } 186 - final_addr = hao->addr; 187 - hao->addr = iph->saddr; 188 - iph->saddr = final_addr; 187 + swap(hao->addr, iph->saddr); 189 188 } 190 189 break; 191 190 }