Skip to content

Commit

Permalink
ipv6: remove unnecessary inet6_sk check
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dave Jones authored and David S. Miller committed Dec 29, 2016
1 parent 9eb1247 commit de8499c
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions net/ipv6/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de8499c

Please sign in to comment.