Commit fcfd6dfa authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by David S. Miller

ipv4: mark expected switch fall-throughs

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: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 86e58cce
...@@ -827,6 +827,7 @@ int inet_shutdown(struct socket *sock, int how) ...@@ -827,6 +827,7 @@ int inet_shutdown(struct socket *sock, int how)
err = -ENOTCONN; err = -ENOTCONN;
/* Hack to wake up other listeners, who can poll for /* Hack to wake up other listeners, who can poll for
POLLHUP, even on eg. unconnected UDP sockets -- RR */ POLLHUP, even on eg. unconnected UDP sockets -- RR */
/* fall through */
default: default:
sk->sk_shutdown |= how; sk->sk_shutdown |= how;
if (sk->sk_prot->shutdown) if (sk->sk_prot->shutdown)
...@@ -840,7 +841,7 @@ int inet_shutdown(struct socket *sock, int how) ...@@ -840,7 +841,7 @@ int inet_shutdown(struct socket *sock, int how)
case TCP_LISTEN: case TCP_LISTEN:
if (!(how & RCV_SHUTDOWN)) if (!(how & RCV_SHUTDOWN))
break; break;
/* Fall through */ /* fall through */
case TCP_SYN_SENT: case TCP_SYN_SENT:
err = sk->sk_prot->disconnect(sk, O_NONBLOCK); err = sk->sk_prot->disconnect(sk, O_NONBLOCK);
sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED; sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED;
......
...@@ -1180,6 +1180,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) ...@@ -1180,6 +1180,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
case SIOCSARP: case SIOCSARP:
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM; return -EPERM;
/* fall through */
case SIOCGARP: case SIOCGARP:
err = copy_from_user(&r, arg, sizeof(struct arpreq)); err = copy_from_user(&r, arg, sizeof(struct arpreq));
if (err) if (err)
......
...@@ -1522,6 +1522,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, ...@@ -1522,6 +1522,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
if (inetdev_valid_mtu(dev->mtu)) if (inetdev_valid_mtu(dev->mtu))
break; break;
/* disable IP when MTU is not enough */ /* disable IP when MTU is not enough */
/* fall through */
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
inetdev_destroy(in_dev); inetdev_destroy(in_dev);
break; break;
......
...@@ -1528,6 +1528,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, ...@@ -1528,6 +1528,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
case MRT_ADD_MFC: case MRT_ADD_MFC:
case MRT_DEL_MFC: case MRT_DEL_MFC:
parent = -1; parent = -1;
/* fall through */
case MRT_ADD_MFC_PROXY: case MRT_ADD_MFC_PROXY:
case MRT_DEL_MFC_PROXY: case MRT_DEL_MFC_PROXY:
if (optlen != sizeof(mfc)) { if (optlen != sizeof(mfc)) {
......
...@@ -276,7 +276,8 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, ...@@ -276,7 +276,8 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
else else
return NF_ACCEPT; 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: case IP_CT_NEW:
/* Seen it before? This can happen for loopback, retrans, /* Seen it before? This can happen for loopback, retrans,
* or local packets. * or local packets.
......
...@@ -2885,6 +2885,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const int acked, ...@@ -2885,6 +2885,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const int acked,
(*ack_flag & FLAG_LOST_RETRANS))) (*ack_flag & FLAG_LOST_RETRANS)))
return; return;
/* Change state if cwnd is undone or retransmits are lost */ /* Change state if cwnd is undone or retransmits are lost */
/* fall through */
default: default:
if (tcp_is_reno(tp)) { if (tcp_is_reno(tp)) {
if (flag & FLAG_SND_UNA_ADVANCED) if (flag & FLAG_SND_UNA_ADVANCED)
...@@ -6044,6 +6045,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) ...@@ -6044,6 +6045,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
case TCP_LAST_ACK: case TCP_LAST_ACK:
if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt))
break; break;
/* fall through */
case TCP_FIN_WAIT1: case TCP_FIN_WAIT1:
case TCP_FIN_WAIT2: case TCP_FIN_WAIT2:
/* RFC 793 says to queue data in these states, /* RFC 793 says to queue data in these states,
......
...@@ -1779,8 +1779,9 @@ int tcp_v4_rcv(struct sk_buff *skb) ...@@ -1779,8 +1779,9 @@ int tcp_v4_rcv(struct sk_buff *skb)
refcounted = false; refcounted = false;
goto process; goto process;
} }
/* Fall through to ACK */
} }
/* to ACK */
/* fall through */
case TCP_TW_ACK: case TCP_TW_ACK:
tcp_v4_timewait_ack(sk, skb); tcp_v4_timewait_ack(sk, skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment