summaryrefslogtreecommitdiff
path: root/include/linux/udp.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-03-17 18:55:30 +0300
committerDavid S. Miller <davem@davemloft.net>2023-03-18 15:23:33 +0300
commit94c540fbfc80ef95ec398fc77da1920de2946edb (patch)
tree67b2d9b2150997513e35d9943517dd294b8c8c2f /include/linux/udp.h
parent39a86d059a78bf29b66dd8bbeab04af1d55c02ba (diff)
downloadlinux-94c540fbfc80ef95ec398fc77da1920de2946edb.tar.xz
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 <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/udp.h')
-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)
{