Message ID | 20240202101403.344408-1-edumazet@google.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 89304f91bf8efe832557b00f034493420f16dbdb |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] sctp: preserve const qualifier in sctp_sk() | expand |
On Fri, Feb 2, 2024 at 5:14 AM Eric Dumazet <edumazet@google.com> wrote: > > We can change sctp_sk() to propagate its argument const qualifier, > thanks to container_of_const(). > > Signed-off-by: Eric Dumazet <edumazet@google.com> > Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> > Cc: Xin Long <lucien.xin@gmail.com> Acked-by: Xin Long <lucien.xin@gmail.com>
Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: 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(). > > Signed-off-by: Eric Dumazet <edumazet@google.com> > Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> > Cc: Xin Long <lucien.xin@gmail.com> > > [...] 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!
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 5a24d6d8522af9c814cfbb568c627777705051ac..f24a1bbcb3ef9442f4a739d8b25d92fae582a411 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -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) {
We can change sctp_sk() to propagate its argument const qualifier, thanks to container_of_const(). Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Cc: Xin Long <lucien.xin@gmail.com> --- include/net/sctp/structs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)