]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ipv6: mark expected switch fall-throughs
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Mon, 16 Oct 2017 21:36:52 +0000 (16:36 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 13:13:08 +0000 (14:13 +0100)
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that in some cases I placed the "fall through" comment
on its own line, which is what GCC is expecting to find.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ah6.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_fib.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6mr.c
net/ipv6/netfilter/nf_nat_l3proto_ipv6.c
net/ipv6/raw.c
net/ipv6/tcp_ipv6.c
net/ipv6/xfrm6_policy.c

index 7802b72196f32efb7a838d47f7e3cc27654cbc6e..37bb33fbc742542dd9b99b7189188cfa7bf12048 100644 (file)
@@ -271,6 +271,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 */
                case NEXTHDR_HOP:
                        if (!zero_out_mutable_opts(exthdr.opth)) {
                                net_dbg_ratelimited("overrun %sopts\n",
index 95516138e861ccbe039e9938a0aa98d21865f953..7835dea930b4522befb24cd287a562d5d37642f0 100644 (file)
@@ -89,6 +89,7 @@ static bool ip6_tlvopt_unknown(struct sk_buff *skb, int optoff)
                 */
                if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr))
                        break;
+               /* fall through */
        case 2: /* send ICMP PARM PROB regardless and drop packet */
                icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
                return false;
index 4e52d52a6752fd5d7f70ccb44340bf94068e2aad..6ae5dd3f4d0de422ec36d4c25453f5841fd2a51e 100644 (file)
@@ -864,10 +864,8 @@ static int icmpv6_rcv(struct sk_buff *skb)
                        goto discard_it;
                hdr = icmp6_hdr(skb);
 
-               /*
-                *      Drop through to notify
-                */
-
+               /* to notify */
+               /* fall through */
        case ICMPV6_DEST_UNREACH:
        case ICMPV6_TIME_EXCEED:
        case ICMPV6_PARAMPROB:
index 548af48212fcb575e8e57a8047ffa06d4ca07851..1ada9672d1986a704588a4884b953907368539eb 100644 (file)
@@ -1780,6 +1780,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                        }
                        w->state = FWS_L;
 #endif
+                       /* fall through */
                case FWS_L:
                        left = rcu_dereference_protected(fn->left, 1);
                        if (left) {
@@ -1788,6 +1789,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                                continue;
                        }
                        w->state = FWS_R;
+                       /* fall through */
                case FWS_R:
                        right = rcu_dereference_protected(fn->right, 1);
                        if (right) {
@@ -1797,6 +1799,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                        }
                        w->state = FWS_C;
                        w->leaf = rcu_dereference_protected(fn->leaf, 1);
+                       /* fall through */
                case FWS_C:
                        if (w->leaf && fn->fn_flags & RTN_RTINFO) {
                                int err;
@@ -1815,6 +1818,7 @@ static int fib6_walk_continue(struct fib6_walker *w)
                        }
 skip:
                        w->state = FWS_U;
+                       /* fall through */
                case FWS_U:
                        if (fn == w->root)
                                return 0;
index 825548680b1e22ee44ebe4a7ba6c7b0e141bccf0..4212879ff35e58eedcbb655b3d5f9192abde6055 100644 (file)
@@ -593,6 +593,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        case NDISC_REDIRECT:
                rel_type = ICMP_REDIRECT;
                rel_code = ICMP_REDIR_HOST;
+               /* fall through */
        default:
                return 0;
        }
index f5500f5444e9845b8b6ed423a7ce63e559dd0c40..59fad81e5f7ada3d61f8cd61dc9b778edec9eb25 100644 (file)
@@ -1722,6 +1722,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 */
        case MRT6_ADD_MFC_PROXY:
        case MRT6_DEL_MFC_PROXY:
                if (optlen < sizeof(mfc))
index 46d6dba506989756eba4bcb0d51877b3c7b40eb6..1d2fb9267d6fa85179fd062c59eefbaf5eda491a 100644 (file)
@@ -290,7 +290,8 @@ nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
                        else
                                return NF_ACCEPT;
                }
-               /* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
+               /* Only ICMPs can be IP_CT_IS_REPLY: */
+               /* fall through */
        case IP_CT_NEW:
                /* Seen it before?  This can happen for loopback, retrans,
                 * or local packets.
index e4462b0ff801b71b8ae3a48f446a0fdd93bb22c2..761a473a07c526b0185770b2efec3e6fb9200a24 100644 (file)
@@ -1055,6 +1055,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
+               /* fall through */
        default:
                return ipv6_setsockopt(sk, level, optname, optval, optlen);
        }
@@ -1077,6 +1078,7 @@ static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
+               /* fall through */
        default:
                return compat_ipv6_setsockopt(sk, level, optname,
                                              optval, optlen);
@@ -1138,6 +1140,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
+               /* fall through */
        default:
                return ipv6_getsockopt(sk, level, optname, optval, optlen);
        }
@@ -1160,6 +1163,7 @@ static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_CHECKSUM ||
                    optname == IPV6_HDRINCL)
                        break;
+               /* fall through */
        default:
                return compat_ipv6_getsockopt(sk, level, optname,
                                              optval, optlen);
index 64d94afa427f81fd7a505b1cfd1c0be66c273810..ae83615b7f6d5e9a8f5f35075139ed82b497a990 100644 (file)
@@ -1577,8 +1577,9 @@ static int tcp_v6_rcv(struct sk_buff *skb)
                        refcounted = false;
                        goto process;
                }
-               /* Fall through to ACK */
        }
+               /* to ACK */
+               /* fall through */
        case TCP_TW_ACK:
                tcp_v6_timewait_ack(sk, skb);
                break;
index 11d1314ab6c5c027bdefb6a4283773fd58307bd5..4ed9f8cc3b6af9a5f45a7829381b5666b47d3212 100644 (file)
@@ -152,6 +152,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                switch (nexthdr) {
                case NEXTHDR_FRAGMENT:
                        onlyproto = 1;
+                       /* fall through */
                case NEXTHDR_ROUTING:
                case NEXTHDR_HOP:
                case NEXTHDR_DEST: