Skip to contentSkip to conversation

net: l2tp: mark expected switch fall-through

PATCH Applied Gustavo A. R. Silva 3 participants 3 messages Oct 17, 2017 – Oct 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: l2tp: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Notice that in this particular case I replaced the "NOBREAK" comment with a "fall through" comment, which is what GCC is expecting to find.

---
This code was tested by compilation only (GCC 7.2.0 was used).

 net/l2tp/l2tp_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_netlink.c +1 -1
index 7135f46..f517942 100644
@@ -406,7 +406,7 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
 		if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
 		    nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
 			goto nla_put_failure;
-		/* NOBREAK */
+		/* fall through  */
 	case L2TP_ENCAPTYPE_IP:
 #if IS_ENABLED(CONFIG_IPV6)
 		if (np) {
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Gustavo A. R. Silva

This code was tested by compilation only (GCC 7.2.0 was used).

No worry, this case really has to fall through.

net/l2tp/l2tp_netlink.c static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla · line 411

Quoted 12 lines
net/l2tp/l2tp_netlink.c +1 -1
index 7135f46..f517942 100644
@@ -406,7 +406,7 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
 		if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
 		    nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
 			goto nla_put_failure;
-		/* NOBREAK */
+		/* fall through  */
 	case L2TP_ENCAPTYPE_IP:
 

Nit: extra whitespace before '*/' (just couldn't restrain myself from noticing).

maintainer Applied
#2 lore raw
In reply to Gustavo A. R. Silva

From: "Gustavo A. R. Silva" <[email protected]>
Date: Tue, 17 Oct 2017 17:42:53 -0500

Quoted 7 lines

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Notice that in this particular case I replaced the "NOBREAK" comment with a "fall through" comment, which is what GCC is expecting to find.

Applied to net-next.