diff options
author | David S. Miller <davem@davemloft.net> | 2017-01-04 13:24:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-04 13:24:19 -0500 |
commit | ac4340fc3ce0e0b1cb627b05d6dcbd473544d7b3 (patch) | |
tree | 4987c1a7d7ce5273097bab8debde9ba2fde343ee /net/compat.c | |
parent | 1ff8cebf49ed9e9ca2ae44b5c4176aef9c21af9c (diff) |
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/compat.c')
-rw-r--r-- | net/compat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/compat.c b/net/compat.c index 4e27dd1cd3a6..ba3ac722714d 100644 --- a/net/compat.c +++ b/net/compat.c @@ -130,6 +130,9 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk, __kernel_size_t kcmlen, tmp; int err = -EFAULT; + BUILD_BUG_ON(sizeof(struct compat_cmsghdr) != + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))); + kcmlen = 0; kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf; ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg); |