Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171075
b: refs/heads/master
c: 38bfd8f
h: refs/heads/master
i:
  171073: 2e3c733
  171071: f4273b4
v: v3
  • Loading branch information
Cyrill Gorcunov authored and David S. Miller committed Oct 29, 2009
1 parent 7c22ec3 commit 82e8a93
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ed3f2e40f3d438f4a1ec0a898173116cb26f106a
refs/heads/master: 38bfd8f5bec496e8e0db8849e01c99a33479418a
3 changes: 3 additions & 0 deletions trunk/include/linux/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct __kernel_sockaddr_storage {
#include <linux/types.h> /* pid_t */
#include <linux/compiler.h> /* __user */

#define __sockaddr_check_size(size) \
BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage)))

#ifdef __KERNEL__
# ifdef CONFIG_PROC_FS
struct seq_file;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
{
struct sock *sk = sock->sk;
struct inet_sock *inet = inet_sk(sk);
struct sockaddr_in *sin = (struct sockaddr_in *)uaddr;
DECLARE_SOCKADDR(struct sockaddr_in *, sin, uaddr);

sin->sin_family = AF_INET;
if (peer) {
Expand Down

0 comments on commit 82e8a93

Please sign in to comment.