[PATCH net-next v2 2/2] pppox: convert pppox_sk() to use container_of()
From: Qingfang Deng
Date: Fri Apr 10 2026 - 01:50:38 EST
Use container_of() macro instead of direct pointer casting to get the
pppox_sock from a sock pointer.
Signed-off-by: Qingfang Deng <qingfang.deng@xxxxxxxxx>
---
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/20260408015138.280687-2-qingfang.deng@xxxxxxxxx
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