inet: preserve const qualifier in inet_sk()
authorEric Dumazet <edumazet@google.com>
Thu, 16 Mar 2023 15:31:55 +0000 (15:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Mar 2023 08:56:37 +0000 (08:56 +0000)
commitabc17a11ed29b0471e428d86189acca8d1a213c6
treeda8ab312279911b367d333f13e1880dfd3c30386
parent82b3297009b6831dfe47f0f38ed4043e39f58c9f
inet: preserve const qualifier in inet_sk()

We can change inet_sk() to propagate const qualifier of its argument.

This should avoid some potential errors caused by accidental
(const -> not_const) promotion.

Other helpers like tcp_sk(), udp_sk(), raw_sk() will be handled
in separate patch series.

v2: use container_of_const() as advised by Jakub and Linus

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/netdev/20230315142841.3a2ac99a@kernel.org/
Link: https://lore.kernel.org/netdev/CAHk-=wiOf12nrYEF2vJMcucKjWPN-Ns_SW9fA7LwST_2Dzp7rw@mail.gmail.com/
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/inet_sock.h
include/trace/events/sock.h
include/trace/events/tcp.h
net/ipv4/ip_output.c
net/ipv6/ping.c
net/ipv6/udp.c
net/mptcp/sockopt.c
security/lsm_audit.c