* [PATCH] ipv6:ip6_xmit and ping_v6_sendmsg remove np NULL check
@ 2016-12-06 11:11 Manjeet Pawar
0 siblings, 0 replies; only message in thread
From: Manjeet Pawar @ 2016-12-06 11:11 UTC (permalink / raw)
To: davem, kuznet, jmorris, yoshfuji, kaber, linux-kernel, ajeet.y
Cc: pankaj.m, Rohit Thapliyal, Lorenzo Colitti, Eric Dumazet, Manjeet Pawar
From: Rohit Thapliyal <r.thapliyal@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.thapliyal@samsung.com>
Signed-off-by: David Miller <davem@davemloft.net>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-06 11:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-06 11:11 [PATCH] ipv6:ip6_xmit and ping_v6_sendmsg remove np NULL check Manjeet Pawar
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).