Skip to content

Commit 3a3a4e3

Browse files
JuliaLawalldavem330
authored andcommitted
ipv6: constify inet6_protocol structures
The inet6_protocol structure is only passed as the first argument to inet6_add_protocol or inet6_del_protocol, both of which are declared as const. Thus the inet6_protocol structure itself can be const. Also drop __read_mostly where present on the newly const structures. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1812bc4 commit 3a3a4e3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

net/ipv6/ip6_gre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
10801080
}
10811081

10821082

1083-
static struct inet6_protocol ip6gre_protocol __read_mostly = {
1083+
static const struct inet6_protocol ip6gre_protocol = {
10841084
.handler = gre_rcv,
10851085
.err_handler = ip6gre_err,
10861086
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ struct proto tcpv6_prot = {
19451945
.diag_destroy = tcp_abort,
19461946
};
19471947

1948-
static struct inet6_protocol tcpv6_protocol = {
1948+
static const struct inet6_protocol tcpv6_protocol = {
19491949
.early_demux = tcp_v6_early_demux,
19501950
.early_demux_handler = tcp_v6_early_demux,
19511951
.handler = tcp_v6_rcv,

net/ipv6/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
14481448
}
14491449
#endif
14501450

1451-
static struct inet6_protocol udpv6_protocol = {
1451+
static const struct inet6_protocol udpv6_protocol = {
14521452
.early_demux = udp_v6_early_demux,
14531453
.early_demux_handler = udp_v6_early_demux,
14541454
.handler = udpv6_rcv,

0 commit comments

Comments
 (0)