diff options
author | Eric Dumazet <edumazet@google.com> | 2023-03-16 15:31:55 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-03-17 08:56:37 +0000 |
commit | abc17a11ed29b0471e428d86189acca8d1a213c6 (patch) | |
tree | da8ab312279911b367d333f13e1880dfd3c30386 /security | |
parent | 82b3297009b6831dfe47f0f38ed4043e39f58c9f (diff) | |
download | linux-stable-abc17a11ed29b0471e428d86189acca8d1a213c6.tar.gz linux-stable-abc17a11ed29b0471e428d86189acca8d1a213c6.tar.bz2 linux-stable-abc17a11ed29b0471e428d86189acca8d1a213c6.zip |
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>
Diffstat (limited to 'security')
-rw-r--r-- | security/lsm_audit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index a7355b4b9bb8..00d3bdd386e2 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -317,7 +317,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, switch (sk->sk_family) { case AF_INET: { - struct inet_sock *inet = inet_sk(sk); + const struct inet_sock *inet = inet_sk(sk); print_ipv4_addr(ab, inet->inet_rcv_saddr, inet->inet_sport, @@ -329,7 +329,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, } #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: { - struct inet_sock *inet = inet_sk(sk); + const struct inet_sock *inet = inet_sk(sk); print_ipv6_addr(ab, &sk->sk_v6_rcv_saddr, inet->inet_sport, |