Skip to content

Commit 89304f9

Browse files
edumazetdavem330
authored andcommitted
sctp: preserve const qualifier in sctp_sk()
We can change sctp_sk() to propagate its argument const qualifier, thanks to container_of_const(). Signed-off-by: Eric Dumazet <[email protected]> Cc: Marcelo Ricardo Leitner <[email protected]> Cc: Xin Long <[email protected]> Acked-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ffabe98 commit 89304f9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

include/net/sctp/structs.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ struct sctp_sock {
242242
int do_auto_asconf;
243243
};
244244

245-
static inline struct sctp_sock *sctp_sk(const struct sock *sk)
246-
{
247-
return (struct sctp_sock *)sk;
248-
}
245+
#define sctp_sk(ptr) container_of_const(ptr, struct sctp_sock, inet.sk)
249246

250247
static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp)
251248
{

0 commit comments

Comments
 (0)