diff options
author | Thomas Graf <tgraf@suug.ch> | 2012-06-26 19:36:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-27 18:36:43 -0400 |
commit | 7b46866dd0a6fe38ecee523eb27eda9c8f484dc5 (patch) | |
tree | edf4bd32a276d0e3d2bfcd3c6cc04f178e46f48a | |
parent | 4245375db87767aacaad16f07040b5d89a9056c8 (diff) |
sock_diag: Do not use RTA_PUT() macros
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/sock_diag.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index 0d934ce1075f..ff2967acbfae 100644 --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <net/netlink.h> | 4 | #include <net/netlink.h> |
5 | #include <net/net_namespace.h> | 5 | #include <net/net_namespace.h> |
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/rtnetlink.h> | ||
8 | #include <net/sock.h> | 7 | #include <net/sock.h> |
9 | 8 | ||
10 | #include <linux/inet_diag.h> | 9 | #include <linux/inet_diag.h> |
@@ -35,9 +34,7 @@ EXPORT_SYMBOL_GPL(sock_diag_save_cookie); | |||
35 | 34 | ||
36 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attrtype) | 35 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attrtype) |
37 | { | 36 | { |
38 | __u32 *mem; | 37 | u32 mem[SK_MEMINFO_VARS]; |
39 | |||
40 | mem = RTA_DATA(__RTA_PUT(skb, attrtype, SK_MEMINFO_VARS * sizeof(__u32))); | ||
41 | 38 | ||
42 | mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk); | 39 | mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk); |
43 | mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf; | 40 | mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf; |
@@ -48,10 +45,7 @@ int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attrtype) | |||
48 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); | 45 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); |
49 | mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; | 46 | mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; |
50 | 47 | ||
51 | return 0; | 48 | return nla_put(skb, attrtype, sizeof(mem), &mem); |
52 | |||
53 | rtattr_failure: | ||
54 | return -EMSGSIZE; | ||
55 | } | 49 | } |
56 | EXPORT_SYMBOL_GPL(sock_diag_put_meminfo); | 50 | EXPORT_SYMBOL_GPL(sock_diag_put_meminfo); |
57 | 51 | ||
@@ -121,7 +115,7 @@ static inline void sock_diag_unlock_handler(const struct sock_diag_handler *h) | |||
121 | static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | 115 | static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
122 | { | 116 | { |
123 | int err; | 117 | int err; |
124 | struct sock_diag_req *req = NLMSG_DATA(nlh); | 118 | struct sock_diag_req *req = nlmsg_data(nlh); |
125 | const struct sock_diag_handler *hndl; | 119 | const struct sock_diag_handler *hndl; |
126 | 120 | ||
127 | if (nlmsg_len(nlh) < sizeof(*req)) | 121 | if (nlmsg_len(nlh) < sizeof(*req)) |