Commit 4e852c02 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[INET_DIAG]: whitespace/simple cleanups

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7dbf0755
...@@ -185,7 +185,8 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk, ...@@ -185,7 +185,8 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
return -1; return -1;
} }
static int inet_diag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh) static int inet_diag_get_exact(struct sk_buff *in_skb,
const struct nlmsghdr *nlh)
{ {
int err; int err;
struct sock *sk; struct sock *sk;
...@@ -331,7 +332,8 @@ static int inet_diag_bc_run(const void *bc, int len, ...@@ -331,7 +332,8 @@ static int inet_diag_bc_run(const void *bc, int len,
else else
addr = entry->daddr; addr = entry->daddr;
if (bitstring_match(addr, cond->addr, cond->prefix_len)) if (bitstring_match(addr, cond->addr,
cond->prefix_len))
break; break;
if (entry->family == AF_INET6 && if (entry->family == AF_INET6 &&
cond->family == AF_INET) { cond->family == AF_INET) {
...@@ -449,8 +451,7 @@ static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk, ...@@ -449,8 +451,7 @@ static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk,
} }
static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
struct request_sock *req, struct request_sock *req, u32 pid, u32 seq,
u32 pid, u32 seq,
const struct nlmsghdr *unlh) const struct nlmsghdr *unlh)
{ {
const struct inet_request_sock *ireq = inet_rsk(req); const struct inet_request_sock *ireq = inet_rsk(req);
...@@ -672,7 +673,6 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -672,7 +673,6 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
s_num = 0; s_num = 0;
read_lock_bh(&head->lock); read_lock_bh(&head->lock);
num = 0; num = 0;
sk_for_each(sk, node, &head->chain) { sk_for_each(sk, node, &head->chain) {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
...@@ -684,7 +684,8 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -684,7 +684,8 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
if (r->id.idiag_sport != inet->sport && if (r->id.idiag_sport != inet->sport &&
r->id.idiag_sport) r->id.idiag_sport)
goto next_normal; goto next_normal;
if (r->id.idiag_dport != inet->dport && r->id.idiag_dport) if (r->id.idiag_dport != inet->dport &&
r->id.idiag_dport)
goto next_normal; goto next_normal;
if (inet_diag_dump_sock(skb, sk, cb) < 0) { if (inet_diag_dump_sock(skb, sk, cb) < 0) {
read_unlock_bh(&head->lock); read_unlock_bh(&head->lock);
...@@ -724,8 +725,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -724,8 +725,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
return skb->len; return skb->len;
} }
static __inline__ int static inline int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{ {
if (!(nlh->nlmsg_flags&NLM_F_REQUEST)) if (!(nlh->nlmsg_flags&NLM_F_REQUEST))
return 0; return 0;
...@@ -755,9 +755,8 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -755,9 +755,8 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
} }
return netlink_dump_start(idiagnl, skb, nlh, return netlink_dump_start(idiagnl, skb, nlh,
inet_diag_dump, NULL); inet_diag_dump, NULL);
} else { } else
return inet_diag_get_exact(skb, nlh); return inet_diag_get_exact(skb, nlh);
}
err_inval: err_inval:
return -EINVAL; return -EINVAL;
...@@ -766,12 +765,12 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -766,12 +765,12 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
static inline void inet_diag_rcv_skb(struct sk_buff *skb) static inline void inet_diag_rcv_skb(struct sk_buff *skb)
{ {
if (skb->len >= NLMSG_SPACE(0)) {
int err; int err;
struct nlmsghdr * nlh; struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
if (skb->len >= NLMSG_SPACE(0)) { if (nlh->nlmsg_len < sizeof(*nlh) ||
nlh = (struct nlmsghdr *)skb->data; skb->len < nlh->nlmsg_len)
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
return; return;
err = inet_diag_rcv_msg(skb, nlh); err = inet_diag_rcv_msg(skb, nlh);
if (err || nlh->nlmsg_flags & NLM_F_ACK) if (err || nlh->nlmsg_flags & NLM_F_ACK)
......
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