Commit 13cfa97b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by David S. Miller

net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard

Use guard DECLARE_SOCKADDR in a few more places which allow
us to catch if the structure copied back is too big.
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 37e8273c
...@@ -708,7 +708,7 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, ...@@ -708,7 +708,7 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk); struct netlink_sock *nlk = nlk_sk(sk);
struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; DECLARE_SOCKADDR(struct sockaddr_nl *, nladdr, addr);
nladdr->nl_family = AF_NETLINK; nladdr->nl_family = AF_NETLINK;
nladdr->nl_pad = 0; nladdr->nl_pad = 0;
......
...@@ -1537,7 +1537,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -1537,7 +1537,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
struct net_device *dev; struct net_device *dev;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct packet_sock *po = pkt_sk(sk); struct packet_sock *po = pkt_sk(sk);
struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr; DECLARE_SOCKADDR(struct sockaddr_ll *, sll, uaddr);
if (peer) if (peer)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
...@@ -1259,7 +1259,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_ ...@@ -1259,7 +1259,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct unix_sock *u; struct unix_sock *u;
struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, uaddr);
int err = 0; int err = 0;
if (peer) { if (peer) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment