inet: Use fallthrough;
authorJoe Perches <joe@perches.com>
Thu, 12 Mar 2020 22:50:22 +0000 (15:50 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Mar 2020 22:55:00 +0000 (15:55 -0700)
Convert the various uses of fallthrough comments to fallthrough;

Done via script
Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe@perches.com/
And by hand:

net/ipv6/ip6_fib.c has a fallthrough comment outside of an #ifdef block
that causes gcc to emit a warning if converted in-place.

So move the new fallthrough; inside the containing #ifdef/#endif too.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
26 files changed:
net/ipv4/af_inet.c
net/ipv4/ah4.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/fib_semantics.c
net/ipv4/icmp.c
net/ipv4/ip_output.c
net/ipv4/ipmr.c
net/ipv4/netfilter/nf_log_ipv4.c
net/ipv4/netfilter/nf_nat_pptp.c
net/ipv4/nexthop.c
net/ipv4/tcp.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/ah6.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_fib.c
net/ipv6/ip6mr.c
net/ipv6/ndisc.c
net/ipv6/netfilter/nf_log_ipv6.c
net/ipv6/raw.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c

index 2fe295432c2457518aa518fd4e3f7ba6824d12ba..bd7b4e92e07f08603951e9e983c751f53b023440 100644 (file)
@@ -872,7 +872,7 @@ int inet_shutdown(struct socket *sock, int how)
                err = -ENOTCONN;
                /* Hack to wake up other listeners, who can poll for
                   EPOLLHUP, even on eg. unconnected UDP sockets -- RR */
-               /* fall through */
+               fallthrough;
        default:
                sk->sk_shutdown |= how;
                if (sk->sk_prot->shutdown)
@@ -886,7 +886,7 @@ int inet_shutdown(struct socket *sock, int how)
        case TCP_LISTEN:
                if (!(how & RCV_SHUTDOWN))
                        break;
-               /* fall through */
+               fallthrough;
        case TCP_SYN_SENT:
                err = sk->sk_prot->disconnect(sk, O_NONBLOCK);
                sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED;
index 974179b3b31449e4687045f347973888bbadfbcf..d99e1be94019d06553243ff654c6d99c00de9397 100644 (file)
@@ -107,7 +107,7 @@ static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr)
                        if (optlen < 6)
                                return -EINVAL;
                        memcpy(daddr, optptr+optlen-4, 4);
-                       /* Fall through */
+                       fallthrough;
                default:
                        memset(optptr, 0, optlen);
                }
index 05eb42f347e8f59e0bd737a7f6d8d2921300caad..687971d83b4e760d16f328d65a0ba2e36b6c0dbc 100644 (file)
@@ -1181,7 +1181,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
        case SIOCSARP:
                if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
-               /* fall through */
+               fallthrough;
        case SIOCGARP:
                err = copy_from_user(&r, arg, sizeof(struct arpreq));
                if (err)
index e4632bd2026d8ee9d4e4618fbbf3117648080fa4..30fa42f5997dbc942b03d5b71a172b041b5238cf 100644 (file)
@@ -1566,11 +1566,11 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
                        }
                }
                ip_mc_up(in_dev);
-               /* fall through */
+               fallthrough;
        case NETDEV_CHANGEADDR:
                if (!IN_DEV_ARP_NOTIFY(in_dev))
                        break;
-               /* fall through */
+               fallthrough;
        case NETDEV_NOTIFY_PEERS:
                /* Send gratuitous ARP to notify of link change */
                inetdev_send_gratuitous_arp(dev, in_dev);
@@ -1588,7 +1588,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
                if (inetdev_valid_mtu(dev->mtu))
                        break;
                /* disable IP when MTU is not enough */
-               /* fall through */
+               fallthrough;
        case NETDEV_UNREGISTER:
                inetdev_destroy(in_dev);
                break;
index a803cdd9400a63f7f212ef7735a0490552d49497..e4c62b8f57a8482f1ca61056178007719e43235b 100644 (file)
@@ -1962,7 +1962,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force)
                                case NETDEV_DOWN:
                                case NETDEV_UNREGISTER:
                                        nexthop_nh->fib_nh_flags |= RTNH_F_DEAD;
-                                       /* fall through */
+                                       fallthrough;
                                case NETDEV_CHANGE:
                                        nexthop_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
                                        break;
@@ -1984,7 +1984,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force)
                        case NETDEV_DOWN:
                        case NETDEV_UNREGISTER:
                                fi->fib_flags |= RTNH_F_DEAD;
-                               /* fall through */
+                               fallthrough;
                        case NETDEV_CHANGE:
                                fi->fib_flags |= RTNH_F_LINKDOWN;
                                break;
index f369e7ce685b8374eae04d0ca0c5508463c5e72f..fc61f51d87a3d14933180da66cca052772c21ad4 100644 (file)
@@ -865,7 +865,7 @@ static bool icmp_unreach(struct sk_buff *skb)
                        case 3:
                                if (!icmp_tag_validation(iph->protocol))
                                        goto out;
-                               /* fall through */
+                               fallthrough;
                        case 0:
                                info = ntohs(icmph->un.frag.mtu);
                        }
index d84819893db96d813f4e91def912a59a87a48a7c..aaaaf907e0d83d11c2a006111984eb266c278172 100644 (file)
@@ -333,7 +333,7 @@ static int ip_mc_finish_output(struct net *net, struct sock *sk,
        switch (ret) {
        case NET_XMIT_CN:
                do_cn = true;
-               /* fall through */
+               fallthrough;
        case NET_XMIT_SUCCESS:
                break;
        default:
index 6e68def66822f47fc08d94eddd32a4bd4f9fdfb0..9cf83cc85e4ad5f79d949b1e46ee031e732b0008 100644 (file)
@@ -1465,7 +1465,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
        case MRT_ADD_MFC:
        case MRT_DEL_MFC:
                parent = -1;
-               /* fall through */
+               fallthrough;
        case MRT_ADD_MFC_PROXY:
        case MRT_DEL_MFC_PROXY:
                if (optlen != sizeof(mfc)) {
index 4b2d49cc9f1a1677853531fb34b561fda3ff063d..0c72156130b68b5c6f8c7ae407bbfd0731017f1c 100644 (file)
@@ -173,7 +173,7 @@ static void dump_ipv4_packet(struct net *net, struct nf_log_buf *m,
                case ICMP_REDIRECT:
                        /* Max length: 24 "GATEWAY=255.255.255.255 " */
                        nf_log_buf_add(m, "GATEWAY=%pI4 ", &ich->un.gateway);
-                       /* Fall through */
+                       fallthrough;
                case ICMP_DEST_UNREACH:
                case ICMP_SOURCE_QUENCH:
                case ICMP_TIME_EXCEEDED:
index b2aeb7bf5dacc8cf61951bd1118c968c497ea1a5..3c25a467b3efc9c408ca6f51f622675c81ee4710 100644 (file)
@@ -168,7 +168,7 @@ pptp_outbound_pkt(struct sk_buff *skb,
                pr_debug("unknown outbound packet 0x%04x:%s\n", msg,
                         msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
                                               pptp_msg_name[0]);
-               /* fall through */
+               fallthrough;
        case PPTP_SET_LINK_INFO:
                /* only need to NAT in case PAC is behind NAT box */
        case PPTP_START_SESSION_REQUEST:
@@ -271,7 +271,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
                pr_debug("unknown inbound packet %s\n",
                         msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
                                               pptp_msg_name[0]);
-               /* fall through */
+               fallthrough;
        case PPTP_START_SESSION_REQUEST:
        case PPTP_START_SESSION_REPLY:
        case PPTP_STOP_SESSION_REQUEST:
index d072c326dd641663a39357eb12f0fec259cb8911..fdfca534d0942016a61174ab1e99fc056d6bc65c 100644 (file)
@@ -1327,7 +1327,7 @@ static int rtm_to_nh_config(struct net *net, struct sk_buff *skb,
        case AF_UNSPEC:
                if (tb[NHA_GROUP])
                        break;
-               /* fallthrough */
+               fallthrough;
        default:
                NL_SET_ERR_MSG(extack, "Invalid address family");
                goto out;
index b7134f76f840523954d2ff25b3f80468657e60b6..5c57850fab4b4975335796e4a6ba43f71acaa656 100644 (file)
@@ -2251,7 +2251,7 @@ void tcp_set_state(struct sock *sk, int state)
                if (inet_csk(sk)->icsk_bind_hash &&
                    !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
                        inet_put_port(sk);
-               /* fall through */
+               fallthrough;
        default:
                if (oldstate == TCP_ESTABLISHED)
                        TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB);
index 6b6b57000dad879996310717eeb016d2aad46541..bf4ced9273e8e84b95204db9bfe86867c0a3ee13 100644 (file)
@@ -2865,7 +2865,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,
                      (*ack_flag & FLAG_LOST_RETRANS)))
                        return;
                /* Change state if cwnd is undone or retransmits are lost */
-               /* fall through */
+               fallthrough;
        default:
                if (tcp_is_reno(tp)) {
                        if (flag & FLAG_SND_UNA_ADVANCED)
@@ -6367,7 +6367,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
                                mptcp_incoming_options(sk, skb, &tp->rx_opt);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case TCP_FIN_WAIT1:
        case TCP_FIN_WAIT2:
                /* RFC 793 says to queue data in these states,
@@ -6382,7 +6382,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
                                return 1;
                        }
                }
-               /* Fall through */
+               fallthrough;
        case TCP_ESTABLISHED:
                tcp_data_queue(sk, skb);
                queued = 1;
index 52acf0bc2ee57376e19399206edefada469903e0..83a5d24e13b8c0079d80950acde13c232b4a845e 100644 (file)
@@ -2072,7 +2072,7 @@ do_time_wait:
                }
        }
                /* to ACK */
-               /* fall through */
+               fallthrough;
        case TCP_TW_ACK:
                tcp_v4_timewait_ack(sk, skb);
                break;
@@ -2368,7 +2368,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
                        break;
                st->bucket = 0;
                st->state = TCP_SEQ_STATE_ESTABLISHED;
-               /* Fallthrough */
+               fallthrough;
        case TCP_SEQ_STATE_ESTABLISHED:
                if (st->bucket > tcp_hashinfo.ehash_mask)
                        break;
index a68e2ac37f26c991688d904edbb5f48b4af99b88..2633fc23159312025a04fcf0154b9bc0f796ac7f 100644 (file)
@@ -2563,7 +2563,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
                case UDP_ENCAP_ESPINUDP_NON_IKE:
                        up->encap_rcv = xfrm4_udp_encap_rcv;
 #endif
-                       /* FALLTHROUGH */
+                       fallthrough;
                case UDP_ENCAP_L2TPINUDP:
                        up->encap_type = val;
                        lock_sock(sk);
index cb493e15959c4d1bb68cf30f4099a8daa785bb84..c614249dfb7dc5688e1f990fd912888a7208fadf 100644 (file)
@@ -3299,7 +3299,7 @@ static void addrconf_addr_gen(struct inet6_dev *idev, bool prefix_route)
        switch (idev->cnf.addr_gen_mode) {
        case IN6_ADDR_GEN_MODE_RANDOM:
                ipv6_gen_mode_random_init(idev);
-               /* fallthrough */
+               fallthrough;
        case IN6_ADDR_GEN_MODE_STABLE_PRIVACY:
                if (!ipv6_generate_stable_address(&addr, 0, idev))
                        addrconf_add_linklocal(idev, &addr,
@@ -3517,9 +3517,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
                        break;
 
                run_pending = 1;
-
-               /* fall through */
-
+               fallthrough;
        case NETDEV_UP:
        case NETDEV_CHANGE:
                if (dev->flags & IFF_SLAVE)
index 871d6e52ec678df61eb9870a5f29120e3b1b446c..45e2adc56610a6ab3427c2aaa91876f9dc104528 100644 (file)
@@ -259,7 +259,7 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len, int dir)
                case NEXTHDR_DEST:
                        if (dir == XFRM_POLICY_OUT)
                                ipv6_rearrange_destopt(iph, exthdr.opth);
-                       /* fall through */
+                       fallthrough;
                case NEXTHDR_HOP:
                        if (!zero_out_mutable_opts(exthdr.opth)) {
                                net_dbg_ratelimited("overrun %sopts\n",
index ab5add0fe6b491733488bf21d757bc9e439ca696..bcb9f5e6280866c78cba23cbbe5d78e2d24aa9ba 100644 (file)
@@ -97,7 +97,7 @@ static bool ip6_tlvopt_unknown(struct sk_buff *skb, int optoff,
                 */
                if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr))
                        break;
-               /* fall through */
+               fallthrough;
        case 2: /* send ICMP PARM PROB regardless and drop packet */
                icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
                return false;
index ef408a5090a2ef40ceede2a20fbb0b8ab35569af..2688f3e8216528a116f90f00d433a331ee0ae983 100644 (file)
@@ -898,7 +898,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
                hdr = icmp6_hdr(skb);
 
                /* to notify */
-               /* fall through */
+               fallthrough;
        case ICMPV6_DEST_UNREACH:
        case ICMPV6_TIME_EXCEED:
        case ICMPV6_PARAMPROB:
index 72abf892302f27fd50179b1b5b6d6e0f974a06b9..46ed567194761d32ea533c688955a052d1e58de4 100644 (file)
@@ -2068,8 +2068,8 @@ static int fib6_walk_continue(struct fib6_walker *w)
                                continue;
                        }
                        w->state = FWS_L;
+                       fallthrough;
 #endif
-                       /* fall through */
                case FWS_L:
                        left = rcu_dereference_protected(fn->left, 1);
                        if (left) {
@@ -2078,7 +2078,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                                continue;
                        }
                        w->state = FWS_R;
-                       /* fall through */
+                       fallthrough;
                case FWS_R:
                        right = rcu_dereference_protected(fn->right, 1);
                        if (right) {
@@ -2088,7 +2088,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                        }
                        w->state = FWS_C;
                        w->leaf = rcu_dereference_protected(fn->leaf, 1);
-                       /* fall through */
+                       fallthrough;
                case FWS_C:
                        if (w->leaf && fn->fn_flags & RTN_RTINFO) {
                                int err;
@@ -2107,7 +2107,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                        }
 skip:
                        w->state = FWS_U;
-                       /* fall through */
+                       fallthrough;
                case FWS_U:
                        if (fn == w->root)
                                return 0;
index d6483926f449dff5b3890a34338774c2175c580f..65a54d74acc1f04156c4fec3683165ee09cb04eb 100644 (file)
@@ -1691,7 +1691,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
        case MRT6_ADD_MFC:
        case MRT6_DEL_MFC:
                parent = -1;
-               /* fall through */
+               fallthrough;
        case MRT6_ADD_MFC_PROXY:
        case MRT6_DEL_MFC_PROXY:
                if (optlen < sizeof(mfc))
index 53caf59c591e303c78cc70a88f77b9c2ec1403ba..4a3feccd5b1010357a66da4b4d6d7b3883ec1e4c 100644 (file)
@@ -1782,7 +1782,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
        case NETDEV_CHANGEADDR:
                neigh_changeaddr(&nd_tbl, dev);
                fib6_run_gc(0, net, false);
-               /* fallthrough */
+               fallthrough;
        case NETDEV_UP:
                idev = in6_dev_get(dev);
                if (!idev)
index 22b80db6d88266eb81846bbef96bf8a245097981..da64550a57075fb8a0d246b9c131e1a9592745b7 100644 (file)
@@ -248,7 +248,7 @@ static void dump_ipv6_packet(struct net *net, struct nf_log_buf *m,
                        /* Max length: 17 "POINTER=ffffffff " */
                        nf_log_buf_add(m, "POINTER=%08x ",
                                       ntohl(ic->icmp6_pointer));
-                       /* Fall through */
+                       fallthrough;
                case ICMPV6_DEST_UNREACH:
                case ICMPV6_PKT_TOOBIG:
                case ICMPV6_TIME_EXCEED:
index dfe5e603ffe16b61d2c58088e52e71d736e5d89f..0028aa1d78691523d46bd18ebcd99586995d40c1 100644 (file)
@@ -1076,7 +1076,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return ipv6_setsockopt(sk, level, optname, optval, optlen);
        }
@@ -1099,7 +1099,7 @@ static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return compat_ipv6_setsockopt(sk, level, optname,
                                              optval, optlen);
@@ -1161,7 +1161,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return ipv6_getsockopt(sk, level, optname, optval, optlen);
        }
@@ -1184,7 +1184,7 @@ static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return compat_ipv6_getsockopt(sk, level, optname,
                                              optval, optlen);
index 2931224b674e81e1608cbf5b6a08a31cb6f99415..2430c2f6819a4f4d715f3502806885edd4a2de0c 100644 (file)
@@ -4370,7 +4370,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
                        IP6_INC_STATS(net, idev, IPSTATS_MIB_INADDRERRORS);
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case IPSTATS_MIB_OUTNOROUTES:
                IP6_INC_STATS(net, idev, ipstats_mib_noroutes);
                break;
index eaf09e6b78442e09a17ae40d612864f1915572f7..413b3425ac66bd758bb83562efa955f277da90a5 100644 (file)
@@ -1742,7 +1742,7 @@ do_time_wait:
                }
        }
                /* to ACK */
-               /* fall through */
+               fallthrough;
        case TCP_TW_ACK:
                tcp_v6_timewait_ack(sk, skb);
                break;