Skip to content

Commit

Permalink
net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard
Browse files Browse the repository at this point in the history
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: Cyrill Gorcunov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Cyrill Gorcunov authored and davem330 committed Nov 11, 2009
1 parent 37e8273 commit 13cfa97
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr,
{
struct sock *sk = sock->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_pad = 0;
Expand Down
2 changes: 1 addition & 1 deletion net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
struct net_device *dev;
struct sock *sk = sock->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)
return -EOPNOTSUPP;
Expand Down
2 changes: 1 addition & 1 deletion net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
{
struct sock *sk = sock->sk;
struct unix_sock *u;
struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, uaddr);
int err = 0;

if (peer) {
Expand Down

0 comments on commit 13cfa97

Please sign in to comment.