Skip to contentSkip to conversation

raw: remove redundant pointers saddr and daddr

PATCH In review Colin Ian King 2 participants 2 messages Jun 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 raw: remove redundant pointers saddr and daddr

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

---
 net/ipv6/raw.c | 3 ---
 1 file changed, 3 deletions(-)
net/ipv6/raw.c +0 -3
index 46b560aacc11..722de9dd0ff7 100644
@@ -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)))
Signature · 1 line
2.35.3
#1 lore raw
Quoted 9 lines · Colin Ian King

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

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

https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Quoted 28 lines
---
 net/ipv6/raw.c | 3 ---
 1 file changed, 3 deletions(-)
net/ipv6/raw.c +0 -4
index 46b560aacc11..722de9dd0ff7 100644
@@ -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