[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091024.061209.39469983.davem@davemloft.net>
Date: Sat, 24 Oct 2009 06:12:09 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: gorcunov@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [RFC] net,socket: introduce build_sockaddr_check helper to
catch overflow at build time
From: Cyrill Gorcunov <gorcunov@...il.com>
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists