lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230807195848.43547-1-kuniyu@amazon.com>
Date: Mon, 7 Aug 2023 12:58:48 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <william.xuanziyang@...wei.com>
CC: <adobriyan@...il.com>, <davem@...emloft.net>, <dsahern@...nel.org>,
	<edumazet@...gle.com>, <kuba@...nel.org>, <netdev@...r.kernel.org>,
	<pabeni@...hat.com>, <kuniyu@...zon.com>
Subject: Re: [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation

From: Ziyang Xuan <william.xuanziyang@...wei.com>
Date: Mon, 7 Aug 2023 10:09:47 +0800
> Get a coccinelle warning as follows:
> net/ipv6/exthdrs.c:800:29-30: WARNING opportunity for swap()
> 
> Use swap() to replace opencoded implementation.
> 
> Signed-off-by: Ziyang Xuan <william.xuanziyang@...wei.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>


> ---
>  net/ipv6/exthdrs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
> index f4bfccae003c..4952ae792450 100644
> --- a/net/ipv6/exthdrs.c
> +++ b/net/ipv6/exthdrs.c
> @@ -648,7 +648,6 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
>  	struct inet6_dev *idev = __in6_dev_get(skb->dev);
>  	struct inet6_skb_parm *opt = IP6CB(skb);
>  	struct in6_addr *addr = NULL;
> -	struct in6_addr daddr;
>  	int n, i;
>  	struct ipv6_rt_hdr *hdr;
>  	struct rt0_hdr *rthdr;
> @@ -796,9 +795,7 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
>  		return -1;
>  	}
>  
> -	daddr = *addr;
> -	*addr = ipv6_hdr(skb)->daddr;
> -	ipv6_hdr(skb)->daddr = daddr;
> +	swap(*addr, ipv6_hdr(skb)->daddr);
>  
>  	ip6_route_input(skb);
>  	if (skb_dst(skb)->error) {
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ