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

Configure Feed

Select the types of activity you want to include in your feed.

netfilter: conntrack: use fallthrough to cleanup

These cases all use the same function. we can simplify the code through
fallthrough.

$ size net/netfilter/nf_conntrack_core.o

text data bss dec hex filename
before 81601 81430 768 163799 27fd7 net/netfilter/nf_conntrack_core.o
after 80361 81430 768 162559 27aff net/netfilter/nf_conntrack_core.o

Arch: aarch64
Gcc : gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

Reported-by: k2ci <kernel-bot@kylinos.cn>
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Jackie Liu and committed by
Pablo Neira Ayuso
6be79156 edb2c347

+3 -5
+3 -5
net/netfilter/nf_conntrack_core.c
··· 329 329 return gre_pkt_to_tuple(skb, dataoff, net, tuple); 330 330 #endif 331 331 case IPPROTO_TCP: 332 - case IPPROTO_UDP: /* fallthrough */ 333 - return nf_ct_get_tuple_ports(skb, dataoff, tuple); 332 + case IPPROTO_UDP: 334 333 #ifdef CONFIG_NF_CT_PROTO_UDPLITE 335 334 case IPPROTO_UDPLITE: 336 - return nf_ct_get_tuple_ports(skb, dataoff, tuple); 337 335 #endif 338 336 #ifdef CONFIG_NF_CT_PROTO_SCTP 339 337 case IPPROTO_SCTP: 340 - return nf_ct_get_tuple_ports(skb, dataoff, tuple); 341 338 #endif 342 339 #ifdef CONFIG_NF_CT_PROTO_DCCP 343 340 case IPPROTO_DCCP: 344 - return nf_ct_get_tuple_ports(skb, dataoff, tuple); 345 341 #endif 342 + /* fallthrough */ 343 + return nf_ct_get_tuple_ports(skb, dataoff, tuple); 346 344 default: 347 345 break; 348 346 }