mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
35dfb01314
commit
954d82979b
@@ -1935,7 +1935,7 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt,
|
|||||||
size_kern = match_size;
|
size_kern = match_size;
|
||||||
module_put(match->me);
|
module_put(match->me);
|
||||||
break;
|
break;
|
||||||
case EBT_COMPAT_WATCHER: /* fallthrough */
|
case EBT_COMPAT_WATCHER:
|
||||||
case EBT_COMPAT_TARGET:
|
case EBT_COMPAT_TARGET:
|
||||||
wt = xt_request_find_target(NFPROTO_BRIDGE, name,
|
wt = xt_request_find_target(NFPROTO_BRIDGE, name,
|
||||||
mwt->u.revision);
|
mwt->u.revision);
|
||||||
|
@@ -1644,7 +1644,7 @@ dump_last:
|
|||||||
goto next_set;
|
goto next_set;
|
||||||
if (set->variant->uref)
|
if (set->variant->uref)
|
||||||
set->variant->uref(set, cb, true);
|
set->variant->uref(set, cb, true);
|
||||||
/* fall through */
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
ret = set->variant->list(set, skb, cb);
|
ret = set->variant->list(set, skb, cb);
|
||||||
if (!cb->args[IPSET_CB_ARG0])
|
if (!cb->args[IPSET_CB_ARG0])
|
||||||
|
@@ -257,15 +257,15 @@ static unsigned int get_uint(struct bitstr *bs, int b)
|
|||||||
case 4:
|
case 4:
|
||||||
v |= *bs->cur++;
|
v |= *bs->cur++;
|
||||||
v <<= 8;
|
v <<= 8;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case 3:
|
case 3:
|
||||||
v |= *bs->cur++;
|
v |= *bs->cur++;
|
||||||
v <<= 8;
|
v <<= 8;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case 2:
|
case 2:
|
||||||
v |= *bs->cur++;
|
v |= *bs->cur++;
|
||||||
v <<= 8;
|
v <<= 8;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case 1:
|
case 1:
|
||||||
v |= *bs->cur++;
|
v |= *bs->cur++;
|
||||||
break;
|
break;
|
||||||
|
@@ -610,7 +610,7 @@ void nf_ct_netns_put(struct net *net, uint8_t nfproto)
|
|||||||
switch (nfproto) {
|
switch (nfproto) {
|
||||||
case NFPROTO_BRIDGE:
|
case NFPROTO_BRIDGE:
|
||||||
nf_ct_netns_do_put(net, NFPROTO_BRIDGE);
|
nf_ct_netns_do_put(net, NFPROTO_BRIDGE);
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFPROTO_INET:
|
case NFPROTO_INET:
|
||||||
nf_ct_netns_do_put(net, NFPROTO_IPV4);
|
nf_ct_netns_do_put(net, NFPROTO_IPV4);
|
||||||
nf_ct_netns_do_put(net, NFPROTO_IPV6);
|
nf_ct_netns_do_put(net, NFPROTO_IPV6);
|
||||||
|
@@ -900,7 +900,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
|
|||||||
return -NF_REPEAT;
|
return -NF_REPEAT;
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
}
|
}
|
||||||
/* Fall through */
|
fallthrough;
|
||||||
case TCP_CONNTRACK_IGNORE:
|
case TCP_CONNTRACK_IGNORE:
|
||||||
/* Ignored packets:
|
/* Ignored packets:
|
||||||
*
|
*
|
||||||
|
@@ -60,7 +60,7 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
|
|||||||
ntohs(tuple->src.u.tcp.port),
|
ntohs(tuple->src.u.tcp.port),
|
||||||
ntohs(tuple->dst.u.tcp.port));
|
ntohs(tuple->dst.u.tcp.port));
|
||||||
break;
|
break;
|
||||||
case IPPROTO_UDPLITE: /* fallthrough */
|
case IPPROTO_UDPLITE:
|
||||||
case IPPROTO_UDP:
|
case IPPROTO_UDP:
|
||||||
seq_printf(s, "sport=%hu dport=%hu ",
|
seq_printf(s, "sport=%hu dport=%hu ",
|
||||||
ntohs(tuple->src.u.udp.port),
|
ntohs(tuple->src.u.udp.port),
|
||||||
|
@@ -408,7 +408,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
|
|||||||
static const unsigned int max_attempts = 128;
|
static const unsigned int max_attempts = 128;
|
||||||
|
|
||||||
switch (tuple->dst.protonum) {
|
switch (tuple->dst.protonum) {
|
||||||
case IPPROTO_ICMP: /* fallthrough */
|
case IPPROTO_ICMP:
|
||||||
case IPPROTO_ICMPV6:
|
case IPPROTO_ICMPV6:
|
||||||
/* id is same for either direction... */
|
/* id is same for either direction... */
|
||||||
keyptr = &tuple->src.u.icmp.id;
|
keyptr = &tuple->src.u.icmp.id;
|
||||||
@@ -442,11 +442,11 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
|
|||||||
}
|
}
|
||||||
goto find_free_id;
|
goto find_free_id;
|
||||||
#endif
|
#endif
|
||||||
case IPPROTO_UDP: /* fallthrough */
|
case IPPROTO_UDP:
|
||||||
case IPPROTO_UDPLITE: /* fallthrough */
|
case IPPROTO_UDPLITE:
|
||||||
case IPPROTO_TCP: /* fallthrough */
|
case IPPROTO_TCP:
|
||||||
case IPPROTO_SCTP: /* fallthrough */
|
case IPPROTO_SCTP:
|
||||||
case IPPROTO_DCCP: /* fallthrough */
|
case IPPROTO_DCCP:
|
||||||
if (maniptype == NF_NAT_MANIP_SRC)
|
if (maniptype == NF_NAT_MANIP_SRC)
|
||||||
keyptr = &tuple->src.u.all;
|
keyptr = &tuple->src.u.all;
|
||||||
else
|
else
|
||||||
|
@@ -704,8 +704,7 @@ ipv4_synproxy_hook(void *priv, struct sk_buff *skb,
|
|||||||
nf_ct_seqadj_init(ct, ctinfo, 0);
|
nf_ct_seqadj_init(ct, ctinfo, 0);
|
||||||
synproxy->tsoff = 0;
|
synproxy->tsoff = 0;
|
||||||
this_cpu_inc(snet->stats->conn_reopened);
|
this_cpu_inc(snet->stats->conn_reopened);
|
||||||
|
fallthrough;
|
||||||
/* fall through */
|
|
||||||
case TCP_CONNTRACK_SYN_SENT:
|
case TCP_CONNTRACK_SYN_SENT:
|
||||||
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
@@ -1128,8 +1127,7 @@ ipv6_synproxy_hook(void *priv, struct sk_buff *skb,
|
|||||||
nf_ct_seqadj_init(ct, ctinfo, 0);
|
nf_ct_seqadj_init(ct, ctinfo, 0);
|
||||||
synproxy->tsoff = 0;
|
synproxy->tsoff = 0;
|
||||||
this_cpu_inc(snet->stats->conn_reopened);
|
this_cpu_inc(snet->stats->conn_reopened);
|
||||||
|
fallthrough;
|
||||||
/* fall through */
|
|
||||||
case TCP_CONNTRACK_SYN_SENT:
|
case TCP_CONNTRACK_SYN_SENT:
|
||||||
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
|
@@ -4375,7 +4375,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,
|
|||||||
case NFT_TRANS_ABORT:
|
case NFT_TRANS_ABORT:
|
||||||
case NFT_TRANS_RELEASE:
|
case NFT_TRANS_RELEASE:
|
||||||
set->use--;
|
set->use--;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
nf_tables_unbind_set(ctx, set, binding,
|
nf_tables_unbind_set(ctx, set, binding,
|
||||||
phase == NFT_TRANS_COMMIT);
|
phase == NFT_TRANS_COMMIT);
|
||||||
@@ -6256,7 +6256,7 @@ void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx,
|
|||||||
case NFT_TRANS_ABORT:
|
case NFT_TRANS_ABORT:
|
||||||
case NFT_TRANS_RELEASE:
|
case NFT_TRANS_RELEASE:
|
||||||
flowtable->use--;
|
flowtable->use--;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -7262,7 +7262,7 @@ static int nf_tables_validate(struct net *net)
|
|||||||
break;
|
break;
|
||||||
case NFT_VALIDATE_NEED:
|
case NFT_VALIDATE_NEED:
|
||||||
nft_validate_state_update(net, NFT_VALIDATE_DO);
|
nft_validate_state_update(net, NFT_VALIDATE_DO);
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFT_VALIDATE_DO:
|
case NFT_VALIDATE_DO:
|
||||||
list_for_each_entry(table, &net->nft.tables, list) {
|
list_for_each_entry(table, &net->nft.tables, list) {
|
||||||
if (nft_table_validate(net, table) < 0)
|
if (nft_table_validate(net, table) < 0)
|
||||||
@@ -8336,7 +8336,7 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
|
|||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFT_CONTINUE:
|
case NFT_CONTINUE:
|
||||||
case NFT_BREAK:
|
case NFT_BREAK:
|
||||||
case NFT_RETURN:
|
case NFT_RETURN:
|
||||||
|
@@ -213,7 +213,7 @@ next_rule:
|
|||||||
jumpstack[stackptr].chain = chain;
|
jumpstack[stackptr].chain = chain;
|
||||||
jumpstack[stackptr].rules = rules + 1;
|
jumpstack[stackptr].rules = rules + 1;
|
||||||
stackptr++;
|
stackptr++;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFT_GOTO:
|
case NFT_GOTO:
|
||||||
nft_trace_packet(&info, chain, rule,
|
nft_trace_packet(&info, chain, rule,
|
||||||
NFT_TRACETYPE_RULE);
|
NFT_TRACETYPE_RULE);
|
||||||
|
@@ -451,7 +451,7 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl,
|
|||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
timeouts = nf_tcp_pernet(net)->timeouts;
|
timeouts = nf_tcp_pernet(net)->timeouts;
|
||||||
break;
|
break;
|
||||||
case IPPROTO_UDP: /* fallthrough */
|
case IPPROTO_UDP:
|
||||||
case IPPROTO_UDPLITE:
|
case IPPROTO_UDPLITE:
|
||||||
timeouts = nf_udp_pernet(net)->timeouts;
|
timeouts = nf_udp_pernet(net)->timeouts;
|
||||||
break;
|
break;
|
||||||
|
@@ -43,7 +43,7 @@ void nft_cmp_eval(const struct nft_expr *expr,
|
|||||||
case NFT_CMP_LT:
|
case NFT_CMP_LT:
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
goto mismatch;
|
goto mismatch;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFT_CMP_LTE:
|
case NFT_CMP_LTE:
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
goto mismatch;
|
goto mismatch;
|
||||||
@@ -51,7 +51,7 @@ void nft_cmp_eval(const struct nft_expr *expr,
|
|||||||
case NFT_CMP_GT:
|
case NFT_CMP_GT:
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
goto mismatch;
|
goto mismatch;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case NFT_CMP_GTE:
|
case NFT_CMP_GTE:
|
||||||
if (d < 0)
|
if (d < 0)
|
||||||
goto mismatch;
|
goto mismatch;
|
||||||
|
@@ -129,7 +129,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case NFT_CT_BYTES: /* fallthrough */
|
case NFT_CT_BYTES:
|
||||||
case NFT_CT_PKTS: {
|
case NFT_CT_PKTS: {
|
||||||
const struct nf_conn_acct *acct = nf_conn_acct_find(ct);
|
const struct nf_conn_acct *acct = nf_conn_acct_find(ct);
|
||||||
u64 count = 0;
|
u64 count = 0;
|
||||||
@@ -1013,8 +1013,8 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,
|
|||||||
help6 = nf_conntrack_helper_try_module_get(name, family,
|
help6 = nf_conntrack_helper_try_module_get(name, family,
|
||||||
priv->l4proto);
|
priv->l4proto);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_NETDEV: /* fallthrough */
|
case NFPROTO_NETDEV:
|
||||||
case NFPROTO_BRIDGE: /* same */
|
case NFPROTO_BRIDGE:
|
||||||
case NFPROTO_INET:
|
case NFPROTO_INET:
|
||||||
help4 = nf_conntrack_helper_try_module_get(name, NFPROTO_IPV4,
|
help4 = nf_conntrack_helper_try_module_get(name, NFPROTO_IPV4,
|
||||||
priv->l4proto);
|
priv->l4proto);
|
||||||
|
@@ -32,7 +32,7 @@ int nft_fib_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
|
|||||||
unsigned int hooks;
|
unsigned int hooks;
|
||||||
|
|
||||||
switch (priv->result) {
|
switch (priv->result) {
|
||||||
case NFT_FIB_RESULT_OIF: /* fallthrough */
|
case NFT_FIB_RESULT_OIF:
|
||||||
case NFT_FIB_RESULT_OIFNAME:
|
case NFT_FIB_RESULT_OIFNAME:
|
||||||
hooks = (1 << NF_INET_PRE_ROUTING);
|
hooks = (1 << NF_INET_PRE_ROUTING);
|
||||||
break;
|
break;
|
||||||
|
@@ -467,7 +467,7 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
|
|||||||
case IPPROTO_UDP:
|
case IPPROTO_UDP:
|
||||||
if (!nft_payload_udp_checksum(skb, pkt->xt.thoff))
|
if (!nft_payload_udp_checksum(skb, pkt->xt.thoff))
|
||||||
return -1;
|
return -1;
|
||||||
/* Fall through. */
|
fallthrough;
|
||||||
case IPPROTO_UDPLITE:
|
case IPPROTO_UDPLITE:
|
||||||
*l4csum_offset = offsetof(struct udphdr, check);
|
*l4csum_offset = offsetof(struct udphdr, check);
|
||||||
break;
|
break;
|
||||||
|
@@ -25,7 +25,7 @@ __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
|
|||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case CHECKSUM_NONE:
|
case CHECKSUM_NONE:
|
||||||
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP)
|
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP)
|
||||||
skb->csum = 0;
|
skb->csum = 0;
|
||||||
@@ -51,7 +51,7 @@ static __sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook,
|
|||||||
case CHECKSUM_COMPLETE:
|
case CHECKSUM_COMPLETE:
|
||||||
if (len == skb->len - dataoff)
|
if (len == skb->len - dataoff)
|
||||||
return nf_ip_checksum(skb, hook, dataoff, protocol);
|
return nf_ip_checksum(skb, hook, dataoff, protocol);
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case CHECKSUM_NONE:
|
case CHECKSUM_NONE:
|
||||||
skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol,
|
skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol,
|
||||||
skb->len - dataoff, 0);
|
skb->len - dataoff, 0);
|
||||||
@@ -79,7 +79,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
|||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case CHECKSUM_NONE:
|
case CHECKSUM_NONE:
|
||||||
skb->csum = ~csum_unfold(
|
skb->csum = ~csum_unfold(
|
||||||
csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
|
csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
|
||||||
@@ -106,7 +106,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
|
|||||||
case CHECKSUM_COMPLETE:
|
case CHECKSUM_COMPLETE:
|
||||||
if (len == skb->len - dataoff)
|
if (len == skb->len - dataoff)
|
||||||
return nf_ip6_checksum(skb, hook, dataoff, protocol);
|
return nf_ip6_checksum(skb, hook, dataoff, protocol);
|
||||||
/* fall through */
|
fallthrough;
|
||||||
case CHECKSUM_NONE:
|
case CHECKSUM_NONE:
|
||||||
hsum = skb_checksum(skb, 0, dataoff, 0);
|
hsum = skb_checksum(skb, 0, dataoff, 0);
|
||||||
skb->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
|
skb->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
|
||||||
|
@@ -1571,7 +1571,7 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos,
|
|||||||
trav->curr = trav->curr->next;
|
trav->curr = trav->curr->next;
|
||||||
if (trav->curr != trav->head)
|
if (trav->curr != trav->head)
|
||||||
break;
|
break;
|
||||||
/* fall through */
|
fallthrough;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user