* [MPTCP] [PATCH net-next 0/2] net: Constify struct genl_ops
@ 2020-10-04 21:58 ` Rikard Falkeborn
0 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-10-04 21:58 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
Make a couple of static struct genl_ops const to allow the compiler to put
them in read-only memory. Patches are independent.
Rikard Falkeborn (2):
mptcp: Constify mptcp_pm_ops
net: openvswitch: Constify static struct genl_ops
net/mptcp/pm_netlink.c | 2 +-
net/openvswitch/conntrack.c | 2 +-
net/openvswitch/meter.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 0/2] net: Constify struct genl_ops
@ 2020-10-04 21:58 ` Rikard Falkeborn
0 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-10-04 21:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel, Rikard Falkeborn, Pravin B Shelar, dev,
Mat Martineau, Matthieu Baerts, mptcp
Make a couple of static struct genl_ops const to allow the compiler to put
them in read-only memory. Patches are independent.
Rikard Falkeborn (2):
mptcp: Constify mptcp_pm_ops
net: openvswitch: Constify static struct genl_ops
net/mptcp/pm_netlink.c | 2 +-
net/openvswitch/conntrack.c | 2 +-
net/openvswitch/meter.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [MPTCP] [PATCH net-next 1/2] mptcp: Constify mptcp_pm_ops
2020-10-04 21:58 ` Rikard Falkeborn
@ 2020-10-04 21:58 ` Rikard Falkeborn
-1 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-10-04 21:58 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
The only usages of mptcp_pm_ops is to assign its address to the ops field
of the genl_family struct, which is a const pointer, and applying
ARRAY_SIZE() on it. Make it const to allow the compiler to put it in
read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn(a)gmail.com>
---
net/mptcp/pm_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 5a0e4d11bcc3..0681d493ba63 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1054,7 +1054,7 @@ mptcp_nl_cmd_get_limits(struct sk_buff *skb, struct genl_info *info)
return -EMSGSIZE;
}
-static struct genl_ops mptcp_pm_ops[] = {
+static const struct genl_ops mptcp_pm_ops[] = {
{
.cmd = MPTCP_PM_CMD_ADD_ADDR,
.doit = mptcp_nl_cmd_add_addr,
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 1/2] mptcp: Constify mptcp_pm_ops
@ 2020-10-04 21:58 ` Rikard Falkeborn
0 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-10-04 21:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel, Rikard Falkeborn, Mat Martineau,
Matthieu Baerts, mptcp
The only usages of mptcp_pm_ops is to assign its address to the ops field
of the genl_family struct, which is a const pointer, and applying
ARRAY_SIZE() on it. Make it const to allow the compiler to put it in
read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
net/mptcp/pm_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 5a0e4d11bcc3..0681d493ba63 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1054,7 +1054,7 @@ mptcp_nl_cmd_get_limits(struct sk_buff *skb, struct genl_info *info)
return -EMSGSIZE;
}
-static struct genl_ops mptcp_pm_ops[] = {
+static const struct genl_ops mptcp_pm_ops[] = {
{
.cmd = MPTCP_PM_CMD_ADD_ADDR,
.doit = mptcp_nl_cmd_add_addr,
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/2] net: openvswitch: Constify static struct genl_ops
2020-10-04 21:58 ` Rikard Falkeborn
(?)
@ 2020-10-04 21:58 ` Rikard Falkeborn
-1 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-10-04 21:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel, Rikard Falkeborn, Pravin B Shelar, dev
The only usage of these is to assign their address to the ops field in
the genl_family struct, which is a const pointer, and applying
ARRAY_SIZE() on them. Make them const to allow the compiler to put them
in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
net/openvswitch/conntrack.c | 2 +-
net/openvswitch/meter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index e86b9601f5b1..9acdd5a8428c 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -2231,7 +2231,7 @@ static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)
return err;
}
-static struct genl_ops ct_limit_genl_ops[] = {
+static const struct genl_ops ct_limit_genl_ops[] = {
{ .cmd = OVS_CT_LIMIT_CMD_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 3d3d8e094546..8d37f50a3f29 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -672,7 +672,7 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
return false;
}
-static struct genl_ops dp_meter_genl_ops[] = {
+static const struct genl_ops dp_meter_genl_ops[] = {
{ .cmd = OVS_METER_CMD_FEATURES,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.flags = 0, /* OK for unprivileged users. */
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [MPTCP] Re: [PATCH net-next 0/2] net: Constify struct genl_ops
2020-10-04 21:58 ` Rikard Falkeborn
@ 2020-10-04 22:06 ` David Miller
-1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2020-10-04 22:06 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
From: Rikard Falkeborn <rikard.falkeborn(a)gmail.com>
Date: Sun, 4 Oct 2020 23:58:08 +0200
> Make a couple of static struct genl_ops const to allow the compiler to put
> them in read-only memory. Patches are independent.
These do not apply cleanly to net-next, please respin.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/2] net: Constify struct genl_ops
@ 2020-10-04 22:06 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2020-10-04 22:06 UTC (permalink / raw)
To: rikard.falkeborn
Cc: kuba, netdev, linux-kernel, pshelar, dev, mathew.j.martineau,
matthieu.baerts, mptcp
From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Date: Sun, 4 Oct 2020 23:58:08 +0200
> Make a couple of static struct genl_ops const to allow the compiler to put
> them in read-only memory. Patches are independent.
These do not apply cleanly to net-next, please respin.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-04 22:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 22:06 [MPTCP] Re: [PATCH net-next 0/2] net: Constify struct genl_ops David Miller
2020-10-04 22:06 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2020-10-04 21:58 [MPTCP] [PATCH net-next 1/2] mptcp: Constify mptcp_pm_ops Rikard Falkeborn
2020-10-04 21:58 ` Rikard Falkeborn
2020-10-04 21:58 [MPTCP] [PATCH net-next 0/2] net: Constify struct genl_ops Rikard Falkeborn
2020-10-04 21:58 ` Rikard Falkeborn
2020-10-04 21:58 ` [PATCH net-next 2/2] net: openvswitch: Constify static " Rikard Falkeborn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.