summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-01-04 13:24:19 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-04 13:24:19 -0500
commitac4340fc3ce0e0b1cb627b05d6dcbd473544d7b3 (patch)
tree4987c1a7d7ce5273097bab8debde9ba2fde343ee /net/socket.c
parent1ff8cebf49ed9e9ca2ae44b5c4176aef9c21af9c (diff)
downloadlinux-ac4340fc3ce0e0b1cb627b05d6dcbd473544d7b3.tar.bz2
net: Assert at build time the assumptions we make about the CMSG header.
It must always be the case that CMSG_ALIGN(sizeof(hdr)) == sizeof(hdr). Otherwise there are missing adjustments in the various calculations that parse and build these things. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 8487bf136e5c..5f3b5a2c4f37 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1948,6 +1948,8 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
ctl_buf = msg_sys->msg_control;
ctl_len = msg_sys->msg_controllen;
} else if (ctl_len) {
+ BUILD_BUG_ON(sizeof(struct cmsghdr) !=
+ CMSG_ALIGN(sizeof(struct cmsghdr)));
if (ctl_len > sizeof(ctl)) {
ctl_buf = sock_kmalloc(sock->sk, ctl_len, GFP_KERNEL);
if (ctl_buf == NULL)