Skip to content

Commit 4e852c0

Browse files
Arnaldo Carvalho de Melodavem330
authored andcommitted
[INET_DIAG]: whitespace/simple cleanups
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7dbf075 commit 4e852c0

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

net/ipv4/inet_diag.c

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ static struct sock *idiagnl;
5151
RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
5252

5353
static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
54-
int ext, u32 pid, u32 seq, u16 nlmsg_flags,
55-
const struct nlmsghdr *unlh)
54+
int ext, u32 pid, u32 seq, u16 nlmsg_flags,
55+
const struct nlmsghdr *unlh)
5656
{
5757
const struct inet_sock *inet = inet_sk(sk);
5858
const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -77,7 +77,7 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
7777
if (ext & (1 << (INET_DIAG_INFO - 1)))
7878
info = INET_DIAG_PUT(skb, INET_DIAG_INFO,
7979
handler->idiag_info_size);
80-
80+
8181
if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) {
8282
size_t len = strlen(icsk->icsk_ca_ops->name);
8383
strcpy(INET_DIAG_PUT(skb, INET_DIAG_CONG, len + 1),
@@ -185,7 +185,8 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
185185
return -1;
186186
}
187187

188-
static int inet_diag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh)
188+
static int inet_diag_get_exact(struct sk_buff *in_skb,
189+
const struct nlmsghdr *nlh)
189190
{
190191
int err;
191192
struct sock *sk;
@@ -283,7 +284,7 @@ static int bitstring_match(const u32 *a1, const u32 *a2, int bits)
283284

284285

285286
static int inet_diag_bc_run(const void *bc, int len,
286-
const struct inet_diag_entry *entry)
287+
const struct inet_diag_entry *entry)
287288
{
288289
while (len > 0) {
289290
int yes = 1;
@@ -322,7 +323,7 @@ static int inet_diag_bc_run(const void *bc, int len,
322323
yes = 0;
323324
break;
324325
}
325-
326+
326327
if (cond->prefix_len == 0)
327328
break;
328329

@@ -331,7 +332,8 @@ static int inet_diag_bc_run(const void *bc, int len,
331332
else
332333
addr = entry->daddr;
333334

334-
if (bitstring_match(addr, cond->addr, cond->prefix_len))
335+
if (bitstring_match(addr, cond->addr,
336+
cond->prefix_len))
335337
break;
336338
if (entry->family == AF_INET6 &&
337339
cond->family == AF_INET) {
@@ -346,7 +348,7 @@ static int inet_diag_bc_run(const void *bc, int len,
346348
}
347349
}
348350

349-
if (yes) {
351+
if (yes) {
350352
len -= op->yes;
351353
bc += op->yes;
352354
} else {
@@ -407,14 +409,14 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
407409
default:
408410
return -EINVAL;
409411
}
410-
bc += op->yes;
412+
bc += op->yes;
411413
len -= op->yes;
412414
}
413415
return len == 0 ? 0 : -EINVAL;
414416
}
415417

416418
static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk,
417-
struct netlink_callback *cb)
419+
struct netlink_callback *cb)
418420
{
419421
struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
420422

@@ -445,13 +447,12 @@ static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk,
445447
}
446448

447449
return inet_diag_fill(skb, sk, r->idiag_ext, NETLINK_CB(cb->skb).pid,
448-
cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
450+
cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
449451
}
450452

451453
static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
452-
struct request_sock *req,
453-
u32 pid, u32 seq,
454-
const struct nlmsghdr *unlh)
454+
struct request_sock *req, u32 pid, u32 seq,
455+
const struct nlmsghdr *unlh)
455456
{
456457
const struct inet_request_sock *ireq = inet_rsk(req);
457458
struct inet_sock *inet = inet_sk(sk);
@@ -504,7 +505,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
504505
}
505506

506507
static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
507-
struct netlink_callback *cb)
508+
struct netlink_callback *cb)
508509
{
509510
struct inet_diag_entry entry;
510511
struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
@@ -556,7 +557,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
556557
inet6_rsk(req)->loc_addr.s6_addr32 :
557558
#endif
558559
&ireq->loc_addr;
559-
entry.daddr =
560+
entry.daddr =
560561
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
561562
(entry.family == AF_INET6) ?
562563
inet6_rsk(req)->rmt_addr.s6_addr32 :
@@ -599,7 +600,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
599600
handler = inet_diag_table[cb->nlh->nlmsg_type];
600601
BUG_ON(handler == NULL);
601602
hashinfo = handler->idiag_hashinfo;
602-
603+
603604
s_i = cb->args[1];
604605
s_num = num = cb->args[2];
605606

@@ -672,7 +673,6 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
672673
s_num = 0;
673674

674675
read_lock_bh(&head->lock);
675-
676676
num = 0;
677677
sk_for_each(sk, node, &head->chain) {
678678
struct inet_sock *inet = inet_sk(sk);
@@ -684,7 +684,8 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
684684
if (r->id.idiag_sport != inet->sport &&
685685
r->id.idiag_sport)
686686
goto next_normal;
687-
if (r->id.idiag_dport != inet->dport && r->id.idiag_dport)
687+
if (r->id.idiag_dport != inet->dport &&
688+
r->id.idiag_dport)
688689
goto next_normal;
689690
if (inet_diag_dump_sock(skb, sk, cb) < 0) {
690691
read_unlock_bh(&head->lock);
@@ -724,8 +725,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
724725
return skb->len;
725726
}
726727

727-
static __inline__ int
728-
inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
728+
static inline int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
729729
{
730730
if (!(nlh->nlmsg_flags&NLM_F_REQUEST))
731731
return 0;
@@ -755,9 +755,8 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
755755
}
756756
return netlink_dump_start(idiagnl, skb, nlh,
757757
inet_diag_dump, NULL);
758-
} else {
758+
} else
759759
return inet_diag_get_exact(skb, nlh);
760-
}
761760

762761
err_inval:
763762
return -EINVAL;
@@ -766,15 +765,15 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
766765

767766
static inline void inet_diag_rcv_skb(struct sk_buff *skb)
768767
{
769-
int err;
770-
struct nlmsghdr * nlh;
771-
772768
if (skb->len >= NLMSG_SPACE(0)) {
773-
nlh = (struct nlmsghdr *)skb->data;
774-
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
769+
int err;
770+
struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
771+
772+
if (nlh->nlmsg_len < sizeof(*nlh) ||
773+
skb->len < nlh->nlmsg_len)
775774
return;
776775
err = inet_diag_rcv_msg(skb, nlh);
777-
if (err || nlh->nlmsg_flags & NLM_F_ACK)
776+
if (err || nlh->nlmsg_flags & NLM_F_ACK)
778777
netlink_ack(skb, nlh, err);
779778
}
780779
}

0 commit comments

Comments
 (0)