All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rikard Falkeborn <rikard.falkeborn at gmail.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH net-next v2 1/2] mptcp: Constify mptcp_pm_ops
Date: Mon, 05 Oct 2020 01:44:16 +0200	[thread overview]
Message-ID: <20201004234417.12768-2-rikard.falkeborn@gmail.com> (raw)
In-Reply-To: 20201004234417.12768-1-rikard.falkeborn@gmail.com

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

The only usages of mptcp_pm_ops is to assign its address to the small_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 9f9cd41b7733..0d6f3d912891 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_small_ops mptcp_pm_ops[] = {
+static const struct genl_small_ops mptcp_pm_ops[] = {
 	{
 		.cmd    = MPTCP_PM_CMD_ADD_ADDR,
 		.doit   = mptcp_nl_cmd_add_addr,
-- 
2.28.0

WARNING: multiple messages have this Message-ID (diff)
From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rikard Falkeborn <rikard.falkeborn@gmail.com>,
	Mat Martineau <mathew.j.martineau@linux.intel.com>,
	Matthieu Baerts <matthieu.baerts@tessares.net>,
	mptcp@lists.01.org
Subject: [PATCH net-next v2 1/2] mptcp: Constify mptcp_pm_ops
Date: Mon,  5 Oct 2020 01:44:16 +0200	[thread overview]
Message-ID: <20201004234417.12768-2-rikard.falkeborn@gmail.com> (raw)
In-Reply-To: <20201004234417.12768-1-rikard.falkeborn@gmail.com>

The only usages of mptcp_pm_ops is to assign its address to the small_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 9f9cd41b7733..0d6f3d912891 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_small_ops mptcp_pm_ops[] = {
+static const struct genl_small_ops mptcp_pm_ops[] = {
 	{
 		.cmd    = MPTCP_PM_CMD_ADD_ADDR,
 		.doit   = mptcp_nl_cmd_add_addr,
-- 
2.28.0


             reply	other threads:[~2020-10-04 23:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 23:44 Rikard Falkeborn [this message]
2020-10-04 23:44 ` [PATCH net-next v2 1/2] mptcp: Constify mptcp_pm_ops Rikard Falkeborn
  -- strict thread matches above, loose matches on Subject: below --
2020-10-05  4:15 [MPTCP] Re: [PATCH net-next v2 0/2] net: Constify struct genl_small_ops David Miller
2020-10-05  4:15 ` David Miller
2020-10-04 23:44 [MPTCP] " Rikard Falkeborn
2020-10-04 23:44 ` Rikard Falkeborn
2020-10-04 23:44 ` [PATCH net-next v2 2/2] net: openvswitch: Constify static " Rikard Falkeborn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201004234417.12768-2-rikard.falkeborn@gmail.com \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.