From: Wojciech Drewek <wojciech.drewek@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
<idosch@nvidia.com>, <petrm@nvidia.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<jiri@resnulli.us>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/2 net-next] devlink: Constify the 'table_ops' parameter of devl_dpipe_table_register()
Date: Mon, 3 Jun 2024 10:45:57 +0200 [thread overview]
Message-ID: <37e0f1cd-d6b4-4b7c-b386-7d31423ac7c8@intel.com> (raw)
In-Reply-To: <3d1deee6bb5a31ee1a41645223fa8b4df1eef7ba.1717337525.git.christophe.jaillet@wanadoo.fr>
On 02.06.2024 16:18, Christophe JAILLET wrote:
> "struct devlink_dpipe_table_ops" only contains some function pointers.
>
> Update "struct devlink_dpipe_table" and the 'table_ops' parameter of
> devl_dpipe_table_register() so that structures in drivers can be
> constified.
>
> Constifying these structures will move some data to a read-only section, so
> increase overall security.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> include/net/devlink.h | 4 ++--
> net/devlink/dpipe.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/devlink.h b/include/net/devlink.h
> index 35eb0f884386..db5eff6cb60f 100644
> --- a/include/net/devlink.h
> +++ b/include/net/devlink.h
> @@ -352,7 +352,7 @@ struct devlink_dpipe_table {
> bool resource_valid;
> u64 resource_id;
> u64 resource_units;
> - struct devlink_dpipe_table_ops *table_ops;
> + const struct devlink_dpipe_table_ops *table_ops;
> struct rcu_head rcu;
> };
>
> @@ -1751,7 +1751,7 @@ void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index);
> void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
> int devl_dpipe_table_register(struct devlink *devlink,
> const char *table_name,
> - struct devlink_dpipe_table_ops *table_ops,
> + const struct devlink_dpipe_table_ops *table_ops,
> void *priv, bool counter_control_extern);
> void devl_dpipe_table_unregister(struct devlink *devlink,
> const char *table_name);
> diff --git a/net/devlink/dpipe.c b/net/devlink/dpipe.c
> index a72a9292efc5..55009b377447 100644
> --- a/net/devlink/dpipe.c
> +++ b/net/devlink/dpipe.c
> @@ -839,7 +839,7 @@ EXPORT_SYMBOL_GPL(devlink_dpipe_table_counter_enabled);
> */
> int devl_dpipe_table_register(struct devlink *devlink,
> const char *table_name,
> - struct devlink_dpipe_table_ops *table_ops,
> + const struct devlink_dpipe_table_ops *table_ops,
> void *priv, bool counter_control_extern)
> {
> struct devlink_dpipe_table *table;
next prev parent reply other threads:[~2024-06-03 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-02 14:18 [PATCH 0/2 net-next] devlink: Constify struct devlink_dpipe_table_ops Christophe JAILLET
2024-06-02 14:18 ` [PATCH 1/2 net-next] devlink: Constify the 'table_ops' parameter of devl_dpipe_table_register() Christophe JAILLET
2024-06-03 8:45 ` Wojciech Drewek [this message]
2024-06-03 10:52 ` Ido Schimmel
2024-06-02 14:18 ` [PATCH 2/2 net-next] mlxsw: spectrum_router: Constify struct devlink_dpipe_table_ops Christophe JAILLET
2024-06-03 8:46 ` Wojciech Drewek
2024-06-03 10:53 ` Ido Schimmel
2024-06-03 12:47 ` [PATCH 0/2 net-next] devlink: " Jiri Pirko
2024-06-05 9:30 ` patchwork-bot+netdevbpf
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=37e0f1cd-d6b4-4b7c-b386-7d31423ac7c8@intel.com \
--to=wojciech.drewek@intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jiri@resnulli.us \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).