[<prev] [next>] [day] [month] [year] [list]
Message-id: <1481022671-37447-1-git-send-email-manjeet.p@samsung.com>
Date: Tue, 06 Dec 2016 16:41:11 +0530
From: Manjeet Pawar <manjeet.p@...sung.com>
To: davem@...emloft.net, kuznet@....inr.ac.ru, jmorris@...ei.org,
yoshfuji@...ux-ipv6.org, kaber@...sh.net,
linux-kernel@...r.kernel.org, ajeet.y@...sung.com
Cc: pankaj.m@...sung.com, Rohit Thapliyal <r.thapliyal@...sung.com>,
Lorenzo Colitti <lorenzo@...gle.com>,
Eric Dumazet <eric.dumazet@...il.com>,
Manjeet Pawar <manjeet.p@...sung.com>
Subject: [PATCH] ipv6:ip6_xmit and ping_v6_sendmsg remove np NULL check
From: Rohit Thapliyal <r.thapliyal@...sung.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@...sung.com>
Signed-off-by: David Miller <davem@...emloft.net>
Signed-off-by: Lorenzo Colitti <lorenzo@...gle.com>
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
Signed-off-by: Manjeet Pawar <manjeet.p@...sung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@...sung.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
Powered by blists - more mailing lists