Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Gustavo A. R. Silva and committed by
Pablo Neira Ayuso
954d8297 35dfb013

+34 -36
+1 -1
net/bridge/netfilter/ebtables.c
··· 1935 1935 size_kern = match_size; 1936 1936 module_put(match->me); 1937 1937 break; 1938 - case EBT_COMPAT_WATCHER: /* fallthrough */ 1938 + case EBT_COMPAT_WATCHER: 1939 1939 case EBT_COMPAT_TARGET: 1940 1940 wt = xt_request_find_target(NFPROTO_BRIDGE, name, 1941 1941 mwt->u.revision);
+1 -1
net/netfilter/ipset/ip_set_core.c
··· 1644 1644 goto next_set; 1645 1645 if (set->variant->uref) 1646 1646 set->variant->uref(set, cb, true); 1647 - /* fall through */ 1647 + fallthrough; 1648 1648 default: 1649 1649 ret = set->variant->list(set, skb, cb); 1650 1650 if (!cb->args[IPSET_CB_ARG0])
+3 -3
net/netfilter/nf_conntrack_h323_asn1.c
··· 257 257 case 4: 258 258 v |= *bs->cur++; 259 259 v <<= 8; 260 - /* fall through */ 260 + fallthrough; 261 261 case 3: 262 262 v |= *bs->cur++; 263 263 v <<= 8; 264 - /* fall through */ 264 + fallthrough; 265 265 case 2: 266 266 v |= *bs->cur++; 267 267 v <<= 8; 268 - /* fall through */ 268 + fallthrough; 269 269 case 1: 270 270 v |= *bs->cur++; 271 271 break;
+1 -1
net/netfilter/nf_conntrack_proto.c
··· 610 610 switch (nfproto) { 611 611 case NFPROTO_BRIDGE: 612 612 nf_ct_netns_do_put(net, NFPROTO_BRIDGE); 613 - /* fall through */ 613 + fallthrough; 614 614 case NFPROTO_INET: 615 615 nf_ct_netns_do_put(net, NFPROTO_IPV4); 616 616 nf_ct_netns_do_put(net, NFPROTO_IPV6);
+1 -1
net/netfilter/nf_conntrack_proto_tcp.c
··· 900 900 return -NF_REPEAT; 901 901 return NF_DROP; 902 902 } 903 - /* Fall through */ 903 + fallthrough; 904 904 case TCP_CONNTRACK_IGNORE: 905 905 /* Ignored packets: 906 906 *
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 60 60 ntohs(tuple->src.u.tcp.port), 61 61 ntohs(tuple->dst.u.tcp.port)); 62 62 break; 63 - case IPPROTO_UDPLITE: /* fallthrough */ 63 + case IPPROTO_UDPLITE: 64 64 case IPPROTO_UDP: 65 65 seq_printf(s, "sport=%hu dport=%hu ", 66 66 ntohs(tuple->src.u.udp.port),
+6 -6
net/netfilter/nf_nat_core.c
··· 408 408 static const unsigned int max_attempts = 128; 409 409 410 410 switch (tuple->dst.protonum) { 411 - case IPPROTO_ICMP: /* fallthrough */ 411 + case IPPROTO_ICMP: 412 412 case IPPROTO_ICMPV6: 413 413 /* id is same for either direction... */ 414 414 keyptr = &tuple->src.u.icmp.id; ··· 442 442 } 443 443 goto find_free_id; 444 444 #endif 445 - case IPPROTO_UDP: /* fallthrough */ 446 - case IPPROTO_UDPLITE: /* fallthrough */ 447 - case IPPROTO_TCP: /* fallthrough */ 448 - case IPPROTO_SCTP: /* fallthrough */ 449 - case IPPROTO_DCCP: /* fallthrough */ 445 + case IPPROTO_UDP: 446 + case IPPROTO_UDPLITE: 447 + case IPPROTO_TCP: 448 + case IPPROTO_SCTP: 449 + case IPPROTO_DCCP: 450 450 if (maniptype == NF_NAT_MANIP_SRC) 451 451 keyptr = &tuple->src.u.all; 452 452 else
+2 -4
net/netfilter/nf_synproxy_core.c
··· 704 704 nf_ct_seqadj_init(ct, ctinfo, 0); 705 705 synproxy->tsoff = 0; 706 706 this_cpu_inc(snet->stats->conn_reopened); 707 - 708 - /* fall through */ 707 + fallthrough; 709 708 case TCP_CONNTRACK_SYN_SENT: 710 709 if (!synproxy_parse_options(skb, thoff, th, &opts)) 711 710 return NF_DROP; ··· 1127 1128 nf_ct_seqadj_init(ct, ctinfo, 0); 1128 1129 synproxy->tsoff = 0; 1129 1130 this_cpu_inc(snet->stats->conn_reopened); 1130 - 1131 - /* fall through */ 1131 + fallthrough; 1132 1132 case TCP_CONNTRACK_SYN_SENT: 1133 1133 if (!synproxy_parse_options(skb, thoff, th, &opts)) 1134 1134 return NF_DROP;
+4 -4
net/netfilter/nf_tables_api.c
··· 4375 4375 case NFT_TRANS_ABORT: 4376 4376 case NFT_TRANS_RELEASE: 4377 4377 set->use--; 4378 - /* fall through */ 4378 + fallthrough; 4379 4379 default: 4380 4380 nf_tables_unbind_set(ctx, set, binding, 4381 4381 phase == NFT_TRANS_COMMIT); ··· 6256 6256 case NFT_TRANS_ABORT: 6257 6257 case NFT_TRANS_RELEASE: 6258 6258 flowtable->use--; 6259 - /* fall through */ 6259 + fallthrough; 6260 6260 default: 6261 6261 return; 6262 6262 } ··· 7262 7262 break; 7263 7263 case NFT_VALIDATE_NEED: 7264 7264 nft_validate_state_update(net, NFT_VALIDATE_DO); 7265 - /* fall through */ 7265 + fallthrough; 7266 7266 case NFT_VALIDATE_DO: 7267 7267 list_for_each_entry(table, &net->nft.tables, list) { 7268 7268 if (nft_table_validate(net, table) < 0) ··· 8336 8336 default: 8337 8337 return -EINVAL; 8338 8338 } 8339 - /* fall through */ 8339 + fallthrough; 8340 8340 case NFT_CONTINUE: 8341 8341 case NFT_BREAK: 8342 8342 case NFT_RETURN:
+1 -1
net/netfilter/nf_tables_core.c
··· 213 213 jumpstack[stackptr].chain = chain; 214 214 jumpstack[stackptr].rules = rules + 1; 215 215 stackptr++; 216 - /* fall through */ 216 + fallthrough; 217 217 case NFT_GOTO: 218 218 nft_trace_packet(&info, chain, rule, 219 219 NFT_TRACETYPE_RULE);
+2 -2
net/netfilter/nft_cmp.c
··· 43 43 case NFT_CMP_LT: 44 44 if (d == 0) 45 45 goto mismatch; 46 - /* fall through */ 46 + fallthrough; 47 47 case NFT_CMP_LTE: 48 48 if (d > 0) 49 49 goto mismatch; ··· 51 51 case NFT_CMP_GT: 52 52 if (d == 0) 53 53 goto mismatch; 54 - /* fall through */ 54 + fallthrough; 55 55 case NFT_CMP_GTE: 56 56 if (d < 0) 57 57 goto mismatch;
+3 -3
net/netfilter/nft_ct.c
··· 129 129 return; 130 130 } 131 131 #endif 132 - case NFT_CT_BYTES: /* fallthrough */ 132 + case NFT_CT_BYTES: 133 133 case NFT_CT_PKTS: { 134 134 const struct nf_conn_acct *acct = nf_conn_acct_find(ct); 135 135 u64 count = 0; ··· 1013 1013 help6 = nf_conntrack_helper_try_module_get(name, family, 1014 1014 priv->l4proto); 1015 1015 break; 1016 - case NFPROTO_NETDEV: /* fallthrough */ 1017 - case NFPROTO_BRIDGE: /* same */ 1016 + case NFPROTO_NETDEV: 1017 + case NFPROTO_BRIDGE: 1018 1018 case NFPROTO_INET: 1019 1019 help4 = nf_conntrack_helper_try_module_get(name, NFPROTO_IPV4, 1020 1020 priv->l4proto);
+1 -1
net/netfilter/nft_fib.c
··· 32 32 unsigned int hooks; 33 33 34 34 switch (priv->result) { 35 - case NFT_FIB_RESULT_OIF: /* fallthrough */ 35 + case NFT_FIB_RESULT_OIF: 36 36 case NFT_FIB_RESULT_OIFNAME: 37 37 hooks = (1 << NF_INET_PRE_ROUTING); 38 38 break;
+1 -1
net/netfilter/nft_payload.c
··· 467 467 case IPPROTO_UDP: 468 468 if (!nft_payload_udp_checksum(skb, pkt->xt.thoff)) 469 469 return -1; 470 - /* Fall through. */ 470 + fallthrough; 471 471 case IPPROTO_UDPLITE: 472 472 *l4csum_offset = offsetof(struct udphdr, check); 473 473 break;
+4 -4
net/netfilter/utils.c
··· 25 25 skb->ip_summed = CHECKSUM_UNNECESSARY; 26 26 break; 27 27 } 28 - /* fall through */ 28 + fallthrough; 29 29 case CHECKSUM_NONE: 30 30 if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) 31 31 skb->csum = 0; ··· 51 51 case CHECKSUM_COMPLETE: 52 52 if (len == skb->len - dataoff) 53 53 return nf_ip_checksum(skb, hook, dataoff, protocol); 54 - /* fall through */ 54 + fallthrough; 55 55 case CHECKSUM_NONE: 56 56 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol, 57 57 skb->len - dataoff, 0); ··· 79 79 skb->ip_summed = CHECKSUM_UNNECESSARY; 80 80 break; 81 81 } 82 - /* fall through */ 82 + fallthrough; 83 83 case CHECKSUM_NONE: 84 84 skb->csum = ~csum_unfold( 85 85 csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, ··· 106 106 case CHECKSUM_COMPLETE: 107 107 if (len == skb->len - dataoff) 108 108 return nf_ip6_checksum(skb, hook, dataoff, protocol); 109 - /* fall through */ 109 + fallthrough; 110 110 case CHECKSUM_NONE: 111 111 hsum = skb_checksum(skb, 0, dataoff, 0); 112 112 skb->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
+1 -1
net/netfilter/x_tables.c
··· 1571 1571 trav->curr = trav->curr->next; 1572 1572 if (trav->curr != trav->head) 1573 1573 break; 1574 - /* fall through */ 1574 + fallthrough; 1575 1575 default: 1576 1576 return NULL; 1577 1577 }