X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fsocket.c;h=8ef8ba81b9e2048c93363f4a2f98f73b7778cdce;hb=2aaab9a0ccfd2ccf1c957cc2120da8d5593955c5;hp=31105f9048a8a0561123c998279e443b582400ce;hpb=77d2720059618b9b6e827a8b73831eb6c6fad63c;p=linux-2.6 diff --git a/net/socket.c b/net/socket.c index 31105f9048..8ef8ba81b9 100644 --- a/net/socket.c +++ b/net/socket.c @@ -265,7 +265,7 @@ static void sock_destroy_inode(struct inode *inode) container_of(inode, struct socket_alloc, vfs_inode)); } -static void init_once(struct kmem_cache *cachep, void *foo) +static void init_once(void *foo) { struct socket_alloc *ei = (struct socket_alloc *)foo; @@ -1222,6 +1222,12 @@ asmlinkage long sys_socket(int family, int type, int protocol) struct socket *sock; int flags; + /* Check the SOCK_* constants for consistency. */ + BUILD_BUG_ON(SOCK_CLOEXEC != O_CLOEXEC); + BUILD_BUG_ON((SOCK_MAX | SOCK_TYPE_MASK) != SOCK_TYPE_MASK); + BUILD_BUG_ON(SOCK_CLOEXEC & SOCK_TYPE_MASK); + BUILD_BUG_ON(SOCK_NONBLOCK & SOCK_TYPE_MASK); + flags = type & ~SOCK_TYPE_MASK; if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) return -EINVAL;