From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <william.xuanziyang@huawei.com>
Cc: <adobriyan@gmail.com>, <davem@davemloft.net>,
<dsahern@kernel.org>, <edumazet@google.com>, <kuba@kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<kuniyu@amazon.com>
Subject: Re: [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation
Date: Mon, 7 Aug 2023 12:58:48 -0700 [thread overview]
Message-ID: <20230807195848.43547-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20230807020947.1991716-1-william.xuanziyang@huawei.com>
From: Ziyang Xuan <william.xuanziyang@huawei.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@huawei.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.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
next prev parent reply other threads:[~2023-08-07 19:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 2:09 [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation Ziyang Xuan
2023-08-07 4:37 ` Pavan Chebbi
2023-08-07 19:58 ` Kuniyuki Iwashima [this message]
2023-08-08 23:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230807195848.43547-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=william.xuanziyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.