[PATCH mptcp-next v4 2/7] mptcp: add a build check for userspace_pm_dump_addr

Geliang Tang posted 7 patches 5 days, 17 hours ago
[PATCH mptcp-next v4 2/7] mptcp: add a build check for userspace_pm_dump_addr
Posted by Geliang Tang 5 days, 17 hours ago
From: Geliang Tang <tanggeliang@kylinos.cn>

This patch adds a build check for mptcp_userspace_pm_dump_addr() to make
sure there is enough space in 'cb->ctx' to store an address id bitmap.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_userspace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index b50462b527bd..540b2080f02b 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -642,6 +642,8 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg,
 	int ret = -EINVAL;
 	struct sock *sk;
 
+	BUILD_BUG_ON(sizeof(struct id_bitmap) > sizeof(cb->ctx));
+
 	bitmap = (struct id_bitmap *)cb->ctx;
 
 	msk = mptcp_userspace_pm_get_sock(info);
-- 
2.43.0