[PATCH] sock: use hlist_entry_safe

Subsystems: networking [general], networking [sockets], the rest

STALE3507d

2 messages, 2 authors, 2017-01-20 · open the first message on its own page

[PATCH] sock: use hlist_entry_safe

From: Geliang Tang <hidden>
Date: 2017-01-20 14:27:40

Use hlist_entry_safe() instead of open-coding it.

Signed-off-by: Geliang Tang <redacted>
---
 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

Re: [PATCH] sock: use hlist_entry_safe

From: David Miller <davem@davemloft.net>
Date: 2017-01-20 16:39:04

From: Geliang Tang <redacted>
Date: Fri, 20 Jan 2017 22:27:04 +0800
Use hlist_entry_safe() instead of open-coding it.

Signed-off-by: Geliang Tang <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help