* ipv6: remove unnecessary inet6_sk check
@ 2016-12-28 16:53 Dave Jones
2016-12-29 17:06 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dave Jones @ 2016-12-28 16:53 UTC (permalink / raw)
To: netdev
np is already assigned in the variable declaration of ping_v6_sendmsg.
At this point, we have already dereferenced np several times, so the
NULL check is also redundant.
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index e1f8b34d7a2e..9b522fa90e6d 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -126,12 +126,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
return PTR_ERR(dst);
rt = (struct rt6_info *) dst;
- np = inet6_sk(sk);
- if (!np) {
- err = -EBADF;
- goto dst_err_out;
- }
-
if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
fl6.flowi6_oif = np->mcast_oif;
else if (!fl6.flowi6_oif)
@@ -166,7 +160,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}
release_sock(sk);
-dst_err_out:
dst_release(dst);
if (err)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: ipv6: remove unnecessary inet6_sk check
2016-12-28 16:53 ipv6: remove unnecessary inet6_sk check Dave Jones
@ 2016-12-29 17:06 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-29 17:06 UTC (permalink / raw)
To: davej; +Cc: netdev
From: Dave Jones <davej@codemonkey.org.uk>
Date: Wed, 28 Dec 2016 11:53:18 -0500
> np is already assigned in the variable declaration of ping_v6_sendmsg.
> At this point, we have already dereferenced np several times, so the
> NULL check is also redundant.
>
> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
Applied, thanks Dave.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-29 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-28 16:53 ipv6: remove unnecessary inet6_sk check Dave Jones
2016-12-29 17:06 ` David Miller
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.