Subject: Re: [RFC] net,socket: introduce build_sockaddr_check helper to catch overflow at build time

From: David Miller <[email-masked]>
Date: Sat, 24 Oct 2009 06:12:09 -0700 (PDT)

From: Cyrill Gorcunov <[email-masked]>
Date: Sat, 24 Oct 2009 01:43:06 +0400

> Or say it could be something like that
> 
> #define __sockaddr(type, src)	\
> 	({ build_sockaddr_check(sizeof(type)); (type *) src; })
> 
> and say in function af_inet.c:inet_getname instead of
> 
> 	struct sockaddr_in *sin	= (struct sockaddr_in *)uaddr;
> 
> we may write like
> 
> 	struct sockaddr_in *sin	= __sockaddr(struct sockaddr_in, uaddr);
> 
> which would check the size.

Or even a "DECLARE_SOCKADDR(type, src, dest)" which encapsulates the
entire declaration statement.