Skip to contentSkip to conversation

sctp: preserve const qualifier in sctp_sk()

PATCH Applied Eric Dumazet 3 participants 3 messages Feb 2, 2024 – Feb 5, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp: preserve const qualifier in sctp_sk()

We can change sctp_sk() to propagate its argument const qualifier, thanks to container_of_const().

Cc Marcelo Ricardo Leitner <[email protected]>
Cc Xin Long <[email protected]>
---
 include/net/sctp/structs.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/net/sctp/structs.h +1 -4
index 5a24d6d8522af9c814cfbb568c627777705051ac..f24a1bbcb3ef9442f4a739d8b25d92fae582a411 100644
@@ -242,10 +242,7 @@ struct sctp_sock {
 	int do_auto_asconf;
 };
 
-static inline struct sctp_sock *sctp_sk(const struct sock *sk)
-{
-       return (struct sctp_sock *)sk;
-}
+#define sctp_sk(ptr) container_of_const(ptr, struct sctp_sock, inet.sk)
 
 static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp)
 {
Signature · 1 line
2.43.0.594.gd9cf4e227d-goog
#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 2 Feb 2024 10:14:03 +0000 you wrote:

We can change sctp_sk() to propagate its argument const qualifier, thanks to container_of_const().

Cc Marcelo Ricardo Leitner <[email protected]>
Cc Xin Long <[email protected]>

[...]

Here is the summary with links:
- [net-next] sctp: preserve const qualifier in sctp_sk()

    https://git.kernel.org/netdev/net-next/c/89304f91bf8e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html