aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2023-03-17 15:55:30 +0000
committerDavid S. Miller <[email protected]>2023-03-18 12:23:33 +0000
commit94c540fbfc80ef95ec398fc77da1920de2946edb (patch)
tree67b2d9b2150997513e35d9943517dd294b8c8c2f
parent39a86d059a78bf29b66dd8bbeab04af1d55c02ba (diff)
udp: preserve const qualifier in udp_sk()
We can change udp_sk() to propagate const qualifier of its argument, thanks to container_of_const() This should avoid some potential errors caused by accidental (const -> not_const) promotion. Signed-off-by: Eric Dumazet <[email protected]> Cc: Willem de Bruijn <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--include/linux/udp.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h
index a2892e151644..43c1fb2d2c21 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -97,10 +97,7 @@ struct udp_sock {
#define UDP_MAX_SEGMENTS (1 << 6UL)
-static inline struct udp_sock *udp_sk(const struct sock *sk)
-{
- return (struct udp_sock *)sk;
-}
+#define udp_sk(ptr) container_of_const(ptr, struct udp_sock, inet.sk)
static inline void udp_set_no_check6_tx(struct sock *sk, bool val)
{