Skip to content

Commit 4613012

Browse files
apconoledavem330
authored andcommitted
af_unix: Convert the unix_sk macro to an inline function for type safety
As suggested by Eric Dumazet this change replaces the #define with a static inline function to enjoy complaints by the compiler when misusing the API. Signed-off-by: Aaron Conole <aconole@bytheb.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2103d6b commit 4613012

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

include/net/af_unix.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ struct unix_sock {
6363
#define UNIX_GC_MAYBE_CYCLE 1
6464
struct socket_wq peer_wq;
6565
};
66-
#define unix_sk(__sk) ((struct unix_sock *)__sk)
66+
67+
static inline struct unix_sock *unix_sk(struct sock *sk)
68+
{
69+
return (struct unix_sock *)sk;
70+
}
6771

6872
#define peer_wait peer_wq.wait
6973

0 commit comments

Comments
 (0)