netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6:ip6_xmit remove unnecessary np NULL check
@ 2016-11-29  6:32 Manjeet Pawar
  2016-11-29 15:26 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Manjeet Pawar @ 2016-11-29  6:32 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
  Cc: pankaj.m, ajeet.y, Rohit Thapliyal, Manjeet Pawar

From: Rohit Thapliyal <r.thapliyal@samsung.com>

np NULL check doesn't seem required here as it shall never
be NULL anyways in inet6_sk(sk).

Signed-off-by: Rohit Thapliyal <r.thapliyal@samsung.com>
Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Signed-off-by: David Miller <davem@davemloft.net>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>

---
v2->v3: Modified as per the suggestion from David Miller
        ip6_xmit calls are made without checking NULL np
        pointer, so no need to explicitly check NULL np in
        ip6_xmit.

 include/linux/ipv6.h  | 2 +-
 net/ipv6/ip6_output.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a064997..6c9c604 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -299,7 +299,7 @@ struct tcp6_timewait_sock {
 
 static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
-	return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
+	return inet_sk(__sk)->pinet6;
 }
 
 static inline struct raw6_sock *raw6_sk(const struct sock *sk)
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);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-10 11:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29  6:32 [PATCH] ipv6:ip6_xmit remove unnecessary np NULL check Manjeet Pawar
2016-11-29 15:26 ` Eric Dumazet
     [not found] ` <CGME20161129152615epcas3p4929492c0e63d8e859bbff6264a13c56d@epcas3p4.samsung.com>
     [not found]   ` <20161201061422epcms5p83ef5b41a335c4556dd2bc725eed38d8d@epcms5p8>
2016-12-01  6:29     ` Eric Dumazet
2016-12-10 11:46 ` [ipv6] fe17dfdb36: general_protection_fault:#[##]SMP kernel test robot

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).