summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-07-28 18:52:57 -0700
committerDavid S. Miller <davem@davemloft.net>2017-07-28 18:52:57 -0700
commitbdb0effcc0a9e636c0a5406bc2eb78474436143d (patch)
tree330a4946c3c78f542f8c217441841cdfeefe546b
parent1812bc43375a991e982086b400eb2a4acf9d6a01 (diff)
parentd04916a48ad4a3db892b664fa9c3a2a693c378ad (diff)
downloadlinux-bdb0effcc0a9e636c0a5406bc2eb78474436143d.tar.bz2
Merge branch 'inet6_protocol-const'
Julia Lawall says: ==================== 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. Done with the help of Coccinelle. // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct inet6_protocol i@p = { ... }; @ok1@ identifier r.i; expression e1; position p; @@ \(inet6_add_protocol\|inet6_del_protocol\)(&i@p,...) @bad@ position p != {r.p,ok1.p}; identifier r.i; struct inet6_protocol e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct inet6_protocol i = { ... }; // </smpl> ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/ip6_gre.c2
-rw-r--r--net/ipv6/tcp_ipv6.c2
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/l2tp/l2tp_ip6.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 67ff2aaf5dcb..33865d67bcb4 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1080,7 +1080,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
}
-static struct inet6_protocol ip6gre_protocol __read_mostly = {
+static const struct inet6_protocol ip6gre_protocol = {
.handler = gre_rcv,
.err_handler = ip6gre_err,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 90a32576c3d0..2968a33cca7d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1945,7 +1945,7 @@ struct proto tcpv6_prot = {
.diag_destroy = tcp_abort,
};
-static struct inet6_protocol tcpv6_protocol = {
+static const struct inet6_protocol tcpv6_protocol = {
.early_demux = tcp_v6_early_demux,
.early_demux_handler = tcp_v6_early_demux,
.handler = tcp_v6_rcv,
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4a3e65626e8b..5f8b8d766c63 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1448,7 +1448,7 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
}
#endif
-static struct inet6_protocol udpv6_protocol = {
+static const struct inet6_protocol udpv6_protocol = {
.early_demux = udp_v6_early_demux,
.early_demux_handler = udp_v6_early_demux,
.handler = udpv6_rcv,
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 88b397c30d86..d2efcd93e1e2 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -788,7 +788,7 @@ static struct inet_protosw l2tp_ip6_protosw = {
.ops = &l2tp_ip6_ops,
};
-static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
+static const struct inet6_protocol l2tp_ip6_protocol = {
.handler = l2tp_ip6_recv,
};