net,socket: introduce DECLARE_SOCKADDR helper to catch overflow at build time
[safe/jmp/linux-2.6] / include / linux / net.h
index b42bb60..4da9d57 100644 (file)
@@ -199,6 +199,9 @@ struct proto_ops {
                                       struct pipe_inode_info *pipe, size_t len, unsigned int flags);
 };
 
+#define DECLARE_SOCKADDR(type, dst, src)       \
+       type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; })
+
 struct net_proto_family {
        int             family;
        int             (*create)(struct net *net, struct socket *sock, int protocol);