ipv4: mark expected switch fall-throughs
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Mon, 16 Oct 2017 20:48:55 +0000 (15:48 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 13:10:29 +0000 (14:10 +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.

Addresses-Coverity-ID: 115108
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/ipmr.c
net/ipv4/netfilter/nf_nat_l3proto_ipv4.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c

index 43a1bbed7a427b0dd0a9b0b64c8856c81919590b..ce4aa827be059fe83ec36f3fe1c31f2068a95d8b 100644 (file)
@@ -827,6 +827,7 @@ int inet_shutdown(struct socket *sock, int how)
                err = -ENOTCONN;
                /* Hack to wake up other listeners, who can poll for
                   POLLHUP, even on eg. unconnected UDP sockets -- RR */
+               /* fall through */
        default:
                sk->sk_shutdown |= how;
                if (sk->sk_prot->shutdown)
@@ -840,7 +841,7 @@ int inet_shutdown(struct socket *sock, int how)
        case TCP_LISTEN:
                if (!(how & RCV_SHUTDOWN))
                        break;
-               /* Fall through */
+               /* fall through */
        case TCP_SYN_SENT:
                err = sk->sk_prot->disconnect(sk, O_NONBLOCK);
                sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED;
index 7c45b8896709815c5dde5972fd57cb5c3bcb2648..a8d7c5a9fb0523db487e8e51a43dadc192046b1f 100644 (file)
@@ -1180,6 +1180,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 */
        case SIOCGARP:
                err = copy_from_user(&r, arg, sizeof(struct arpreq));
                if (err)
index 6d9b072d903b011f94d0226264a4edadd9a60eb0..e1e2ec0525e6bcf75c552c05843856dfda266d13 100644 (file)
@@ -1522,6 +1522,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 */
        case NETDEV_UNREGISTER:
                inetdev_destroy(in_dev);
                break;
index b3ee01b0551bd8b40b446e389ff4c1b77d69459e..40a43ad294cb3751839cc1dbfc02a360e101d401 100644 (file)
@@ -1528,6 +1528,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 */
        case MRT_ADD_MFC_PROXY:
        case MRT_DEL_MFC_PROXY:
                if (optlen != sizeof(mfc)) {
index a0f37b2082682690f55ae64a089f46c0068faf3f..0443ca4120b09ce248df7e63dbdb4958901f17de 100644 (file)
@@ -276,7 +276,8 @@ nf_nat_ipv4_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 d0682ce2a5d67852ce52063f12c0506324aab984..b2390bfdc68fa33c1fa08725e92426daef871b94 100644 (file)
@@ -2885,6 +2885,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const int acked,
                      (*ack_flag & FLAG_LOST_RETRANS)))
                        return;
                /* Change state if cwnd is undone or retransmits are lost */
+               /* fall through */
        default:
                if (tcp_is_reno(tp)) {
                        if (flag & FLAG_SND_UNA_ADVANCED)
@@ -6044,6 +6045,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
        case TCP_LAST_ACK:
                if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt))
                        break;
+               /* fall through */
        case TCP_FIN_WAIT1:
        case TCP_FIN_WAIT2:
                /* RFC 793 says to queue data in these states,
index 5418ecf03b787a645b1b7ae32207a155f24b87b0..ecee4ddb24c5bd5e83129c14d80fae35a7afcf49 100644 (file)
@@ -1779,8 +1779,9 @@ do_time_wait:
                        refcounted = false;
                        goto process;
                }
-               /* Fall through to ACK */
        }
+               /* to ACK */
+               /* fall through */
        case TCP_TW_ACK:
                tcp_v4_timewait_ack(sk, skb);
                break;