]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dccp: preserve const qualifier in dccp_sk()
authorEric Dumazet <edumazet@google.com>
Fri, 17 Mar 2023 15:55:34 +0000 (15:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 18 Mar 2023 12:23:33 +0000 (12:23 +0000)
We can change dccp_sk() to propagate its argument const qualifier,
thanks to container_of_const().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/dccp.h

index 07e547c02fd8b23e05f1f45a3915b2987faddbe9..325af611909f99793491b437231eba20b589c032 100644 (file)
@@ -305,10 +305,8 @@ struct dccp_sock {
        struct timer_list               dccps_xmit_timer;
 };
 
-static inline struct dccp_sock *dccp_sk(const struct sock *sk)
-{
-       return (struct dccp_sock *)sk;
-}
+#define dccp_sk(ptr)   container_of_const(ptr, struct dccp_sock, \
+                                          dccps_inet_connection.icsk_inet.sk)
 
 static inline const char *dccp_role(const struct sock *sk)
 {