linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] raw: remove redundant pointers saddr and daddr
@ 2022-06-22 11:49 Colin Ian King
  2022-06-22 11:52 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-06-22 11:49 UTC (permalink / raw)
  To: David S . Miller, Hideaki YOSHIFUJI, David Ahern, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: kernel-janitors, linux-kernel

Pointers saddr and daddr are being assigned and are never used. The
pointers are redundant and can be removed.

Cleans up clang scan-build warnings:
net/ipv6/raw.c:348:3: warning: Value stored to 'saddr' is never read
net/ipv6/raw.c:349:3: warning: Value stored to 'daddr' is never read

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 net/ipv6/raw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 46b560aacc11..722de9dd0ff7 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -332,7 +332,6 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
 void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 		u8 type, u8 code, int inner_offset, __be32 info)
 {
-	const struct in6_addr *saddr, *daddr;
 	struct net *net = dev_net(skb->dev);
 	struct hlist_nulls_head *hlist;
 	struct hlist_nulls_node *hnode;
@@ -345,8 +344,6 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
 	sk_nulls_for_each(sk, hnode, hlist) {
 		/* Note: ipv6_hdr(skb) != skb->data */
 		const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
-		saddr = &ip6h->saddr;
-		daddr = &ip6h->daddr;
 
 		if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,
 				  inet6_iif(skb), inet6_iif(skb)))
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] raw: remove redundant pointers saddr and daddr
  2022-06-22 11:49 [PATCH][next] raw: remove redundant pointers saddr and daddr Colin Ian King
@ 2022-06-22 11:52 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2022-06-22 11:52 UTC (permalink / raw)
  To: Colin Ian King
  Cc: David S . Miller, Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski,
	Paolo Abeni, netdev, kernel-janitors, LKML

On Wed, Jun 22, 2022 at 1:49 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> Pointers saddr and daddr are being assigned and are never used. The
> pointers are redundant and can be removed.
>
> Cleans up clang scan-build warnings:
> net/ipv6/raw.c:348:3: warning: Value stored to 'saddr' is never read
> net/ipv6/raw.c:349:3: warning: Value stored to 'daddr' is never read
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Thanks, I have posted this already, with proper tags:

https://patchwork.kernel.org/project/netdevbpf/patch/20220622032303.159394-1-edumazet@google.com/

> ---
>  net/ipv6/raw.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index 46b560aacc11..722de9dd0ff7 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -332,7 +332,6 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
>  void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
>                 u8 type, u8 code, int inner_offset, __be32 info)
>  {
> -       const struct in6_addr *saddr, *daddr;
>         struct net *net = dev_net(skb->dev);
>         struct hlist_nulls_head *hlist;
>         struct hlist_nulls_node *hnode;
> @@ -345,8 +344,6 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
>         sk_nulls_for_each(sk, hnode, hlist) {
>                 /* Note: ipv6_hdr(skb) != skb->data */
>                 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
> -               saddr = &ip6h->saddr;
> -               daddr = &ip6h->daddr;
>
>                 if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,
>                                   inet6_iif(skb), inet6_iif(skb)))
> --
> 2.35.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-22 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 11:49 [PATCH][next] raw: remove redundant pointers saddr and daddr Colin Ian King
2022-06-22 11:52 ` Eric Dumazet

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).