[PATCH net-next v2 2/2] pppox: convert pppox_sk() to use container_of()
Qingfang Deng <[email protected]> Fri, 10 Apr 2026 13:49:50 +0800
| Newsgroups | gmane.linux.ppp,gmane.linux.network,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
Use container_of() macro instead of direct pointer casting to get the pppox_sock from a sock pointer. Signed-off-by: Qingfang Deng <[email protected]> --- Changes in v2: Do not remove the comment, as the struct is allocated from sk_alloc and still require sock to be the first member. Link to v1: https://lore.kernel.org/r/[email protected] include/linux/if_pppox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 636772693f9a..594d6dc3f4c9 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -54,7 +54,7 @@ struct pppox_sock { static inline struct pppox_sock *pppox_sk(struct sock *sk) { - return (struct pppox_sock *)sk; + return container_of(sk, struct pppox_sock, sk); } struct module; -- 2.43.0