Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: preserve const qualifier in tcp_rsk() and inet_rsk()

We can change tcp_rsk() and inet_rsk() to propagate their argument
const qualifier thanks to container_of_const().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260120125353.1470456-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
a4674aa5 1b58c94e

+5 -11
+1 -4
include/linux/tcp.h
··· 181 181 #endif 182 182 }; 183 183 184 - static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 185 - { 186 - return (struct tcp_request_sock *)req; 187 - } 184 + #define tcp_rsk(ptr) container_of_const(ptr, struct tcp_request_sock, req.req) 188 185 189 186 static inline bool tcp_rsk_used_ao(const struct request_sock *req) 190 187 {
+1 -4
include/net/inet_sock.h
··· 100 100 }; 101 101 }; 102 102 103 - static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 104 - { 105 - return (struct inet_request_sock *)sk; 106 - } 103 + #define inet_rsk(ptr) container_of_const(ptr, struct inet_request_sock, req) 107 104 108 105 static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb) 109 106 {
+1 -1
include/trace/events/tcp.h
··· 305 305 ), 306 306 307 307 TP_fast_assign( 308 - struct inet_request_sock *ireq = inet_rsk(req); 308 + const struct inet_request_sock *ireq = inet_rsk(req); 309 309 __be32 *p32; 310 310 311 311 __entry->skaddr = sk;
+1 -1
net/ipv4/inet_connection_sock.c
··· 1196 1196 { 1197 1197 struct sock *newsk = sk_clone_lock(sk, priority); 1198 1198 struct inet_connection_sock *newicsk; 1199 - struct inet_request_sock *ireq; 1199 + const struct inet_request_sock *ireq; 1200 1200 struct inet_sock *newinet; 1201 1201 1202 1202 if (!newsk)
+1 -1
net/ipv6/inet6_connection_sock.c
··· 29 29 const struct request_sock *req, 30 30 u8 proto) 31 31 { 32 - struct inet_request_sock *ireq = inet_rsk(req); 32 + const struct inet_request_sock *ireq = inet_rsk(req); 33 33 const struct ipv6_pinfo *np = inet6_sk(sk); 34 34 struct in6_addr *final_p, final; 35 35 struct dst_entry *dst;