* [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation
@ 2023-08-07 2:09 Ziyang Xuan
2023-08-07 4:37 ` Pavan Chebbi
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ziyang Xuan @ 2023-08-07 2:09 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, netdev; +Cc: adobriyan
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation
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
2023-08-08 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Pavan Chebbi @ 2023-08-07 4:37 UTC (permalink / raw)
To: Ziyang Xuan; +Cc: davem, dsahern, edumazet, kuba, pabeni, netdev, adobriyan
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
On Mon, Aug 7, 2023 at 7:40 AM Ziyang Xuan
<william.xuanziyang@huawei.com> wrote:
>
> 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>
> ---
> net/ipv6/exthdrs.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation
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
2023-08-08 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2023-08-07 19:58 UTC (permalink / raw)
To: william.xuanziyang
Cc: adobriyan, davem, dsahern, edumazet, kuba, netdev, pabeni, kuniyu
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ipv6: exthdrs: Replace opencoded swap() implementation
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
@ 2023-08-08 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-08 23:00 UTC (permalink / raw)
To: Ziyang Xuan; +Cc: davem, dsahern, edumazet, kuba, pabeni, netdev, adobriyan
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 7 Aug 2023 10:09:47 +0800 you wrote:
> 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>
>
> [...]
Here is the summary with links:
- [net-next] ipv6: exthdrs: Replace opencoded swap() implementation
https://git.kernel.org/netdev/net-next/c/794529c44800
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-08 23:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-08-08 23:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).