net: clean up codestyle for net/ipv4
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 25 Aug 2020 12:32:11 +0000 (08:32 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2020 13:28:02 +0000 (06:28 -0700)
This is a pure codestyle cleanup patch. Also add a blank line after
declarations as warned by checkpatch.pl.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/route.c

index 948747aac4e2d098c28b8bd185ef14d84c548500..da1b5038bdfd047e2bacd03bd289a51579bd69f2 100644 (file)
@@ -47,32 +47,32 @@ void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
        unsigned char *iph = skb_network_header(skb);
 
        memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options));
-       memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen);
+       memcpy(iph + sizeof(struct iphdr), opt->__data, opt->optlen);
        opt = &(IPCB(skb)->opt);
 
        if (opt->srr)
-               memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4);
+               memcpy(iph + opt->srr + iph[opt->srr + 1] - 4, &daddr, 4);
 
        if (!is_frag) {
                if (opt->rr_needaddr)
-                       ip_rt_get_source(iph+opt->rr+iph[opt->rr+2]-5, skb, rt);
+                       ip_rt_get_source(iph + opt->rr + iph[opt->rr + 2] - 5, skb, rt);
                if (opt->ts_needaddr)
-                       ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt);
+                       ip_rt_get_source(iph + opt->ts + iph[opt->ts + 2] - 9, skb, rt);
                if (opt->ts_needtime) {
                        __be32 midtime;
 
                        midtime = inet_current_timestamp();
-                       memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
+                       memcpy(iph + opt->ts + iph[opt->ts + 2] - 5, &midtime, 4);
                }
                return;
        }
        if (opt->rr) {
-               memset(iph+opt->rr, IPOPT_NOP, iph[opt->rr+1]);
+               memset(iph + opt->rr, IPOPT_NOP, iph[opt->rr + 1]);
                opt->rr = 0;
                opt->rr_needaddr = 0;
        }
        if (opt->ts) {
-               memset(iph+opt->ts, IPOPT_NOP, iph[opt->ts+1]);
+               memset(iph + opt->ts, IPOPT_NOP, iph[opt->ts + 1]);
                opt->ts = 0;
                opt->ts_needaddr = opt->ts_needtime = 0;
        }
@@ -495,26 +495,29 @@ EXPORT_SYMBOL(ip_options_compile);
 void ip_options_undo(struct ip_options *opt)
 {
        if (opt->srr) {
-               unsigned  char *optptr = opt->__data+opt->srr-sizeof(struct  iphdr);
-               memmove(optptr+7, optptr+3, optptr[1]-7);
-               memcpy(optptr+3, &opt->faddr, 4);
+               unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr);
+
+               memmove(optptr + 7, optptr + 3, optptr[1] - 7);
+               memcpy(optptr + 3, &opt->faddr, 4);
        }
        if (opt->rr_needaddr) {
-               unsigned  char *optptr = opt->__data+opt->rr-sizeof(struct  iphdr);
+               unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr);
+
                optptr[2] -= 4;
-               memset(&optptr[optptr[2]-1], 0, 4);
+               memset(&optptr[optptr[2] - 1], 0, 4);
        }
        if (opt->ts) {
-               unsigned  char *optptr = opt->__data+opt->ts-sizeof(struct  iphdr);
+               unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr);
+
                if (opt->ts_needtime) {
                        optptr[2] -= 4;
-                       memset(&optptr[optptr[2]-1], 0, 4);
-                       if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC)
+                       memset(&optptr[optptr[2] - 1], 0, 4);
+                       if ((optptr[3] & 0xF) == IPOPT_TS_PRESPEC)
                                optptr[2] -= 4;
                }
                if (opt->ts_needaddr) {
                        optptr[2] -= 4;
-                       memset(&optptr[optptr[2]-1], 0, 4);
+                       memset(&optptr[optptr[2] - 1], 0, 4);
                }
        }
 }
index 61f802d5350c8ed5fcdc1f9ab467221ae0af59cf..329a0ab87542677fc2839ce2d568bae172042240 100644 (file)
@@ -1351,7 +1351,7 @@ ssize_t   ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
        if (cork->flags & IPCORK_OPT)
                opt = cork->opt;
 
-       if (!(rt->dst.dev->features&NETIF_F_SG))
+       if (!(rt->dst.dev->features & NETIF_F_SG))
                return -EOPNOTSUPP;
 
        hh_len = LL_RESERVED_SPACE(rt->dst.dev);
index 18c8baf32de563ea21174f145ca21e4d06d35286..96fcdfb9bb26bfbfb416133939b74291c82dba12 100644 (file)
@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(ipv4_update_pmtu);
 
 static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
 {
-       const struct iphdr *iph = (const struct iphdr *) skb->data;
+       const struct iphdr *iph = (const struct iphdr *)skb->data;
        struct flowi4 fl4;
        struct rtable *rt;
 
@@ -1127,7 +1127,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
                new = true;
        }
 
-       __ip_rt_update_pmtu((struct rtable *) xfrm_dst_path(&rt->dst), &fl4, mtu);
+       __ip_rt_update_pmtu((struct rtable *)xfrm_dst_path(&rt->dst), &fl4, mtu);
 
        if (!dst_check(&rt->dst, 0)) {
                if (new)
@@ -1168,7 +1168,7 @@ EXPORT_SYMBOL_GPL(ipv4_redirect);
 
 void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk)
 {
-       const struct iphdr *iph = (const struct iphdr *) skb->data;
+       const struct iphdr *iph = (const struct iphdr *)skb->data;
        struct flowi4 fl4;
        struct rtable *rt;
        struct net *net = sock_net(sk);