Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1563648 > unrolled thread

[PATCH] sock: use hlist_entry_safe

Started byGeliang Tang <geliangtang@gmail.com>
First post2017-01-20 15:30 +0100
Last post2017-01-20 17:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sock: use hlist_entry_safe Geliang Tang <geliangtang@gmail.com> - 2017-01-20 15:30 +0100
    Re: [PATCH] sock: use hlist_entry_safe David Miller <davem@davemloft.net> - 2017-01-20 17:40 +0100

#1563648 — [PATCH] sock: use hlist_entry_safe

FromGeliang Tang <geliangtang@gmail.com>
Date2017-01-20 15:30 +0100
Subject[PATCH] sock: use hlist_entry_safe
Message-ID<t1Imu-8mw-23@gated-at.bofh.it>
Use hlist_entry_safe() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 include/net/sock.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 4077ec4..c4e1caf1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -544,8 +544,7 @@ static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)
 
 static inline struct sock *sk_next(const struct sock *sk)
 {
-	return sk->sk_node.next ?
-		hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
+	return hlist_entry_safe(sk->sk_node.next, struct sock, sk_node);
 }
 
 static inline struct sock *sk_nulls_next(const struct sock *sk)
-- 
2.9.3

[toc] | [next] | [standalone]


#1563767

FromDavid Miller <davem@davemloft.net>
Date2017-01-20 17:40 +0100
Message-ID<t1Koi-19S-39@gated-at.bofh.it>
In reply to#1563648
From: Geliang Tang <geliangtang@gmail.com>
Date: Fri, 20 Jan 2017 22:27:04 +0800

> Use hlist_entry_safe() instead of open-coding it.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web