From: Rohit Thapliyal <r.thapli...@samsung.com> np NULL check doesn't seem required here as it shall not be NULL anyways in inet6_sk(sk). Also, a minor cleanup in ping_v6_sendmsg.
Signed-off-by: Rohit Thapliyal <r.thapli...@samsung.com> Signed-off-by: David Miller <da...@davemloft.net> Signed-off-by: Lorenzo Colitti <lore...@google.com> Signed-off-by: Eric Dumazet <eric.duma...@gmail.com> Signed-off-by: Manjeet Pawar <manjee...@samsung.com> Reviewed-by: Akhilesh Kumar <akhiles...@samsung.com> --- v4->v5: Modified as per the suggestion from David Miller and Eric, ip6_xmit calls are made without checking NULL np pointer, so no need to explicitly check NULL np in ip6_xmit and ping_v6_sendmsg. net/ipv6/ip6_output.c | 3 +-- net/ipv6/ping.c | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 59eb4ed..f8c63ec 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -213,8 +213,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, /* * Fill in the IPv6 header */ - if (np) - hlimit = np->hop_limit; + hlimit = np->hop_limit; if (hlimit < 0) hlimit = ip6_dst_hoplimit(dst); diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 66e2d9d..a45fbf8 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c @@ -125,12 +125,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) @@ -164,8 +158,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) len); } release_sock(sk); - -dst_err_out: dst_release(dst); if (err) -- 1.9.1