Skip to content

Commit 4cdf85e

Browse files
Yao Jingdavem330
authored andcommitted
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>
1 parent df6160d commit 4cdf85e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

net/ipv6/ah6.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static void ipv6_rearrange_destopt(struct ipv6hdr *iph, struct ipv6_opt_hdr *des
175175
* See 11.3.2 of RFC 3775 for details.
176176
*/
177177
if (opt[off] == IPV6_TLV_HAO) {
178-
struct in6_addr final_addr;
179178
struct ipv6_destopt_hao *hao;
180179

181180
hao = (struct ipv6_destopt_hao *)&opt[off];
@@ -184,9 +183,7 @@ static void ipv6_rearrange_destopt(struct ipv6hdr *iph, struct ipv6_opt_hdr *des
184183
hao->length);
185184
goto bad;
186185
}
187-
final_addr = hao->addr;
188-
hao->addr = iph->saddr;
189-
iph->saddr = final_addr;
186+
swap(hao->addr, iph->saddr);
190187
}
191188
break;
192189
}

0 commit comments

Comments
 (0)