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 2/2 net-next] mlxsw: spectrum_router: Constify struct devlink_dpipe_table_ops
Date: Mon, 3 Jun 2024 10:46:15 +0200 [thread overview]
Message-ID: <49b0247f-f2df-4b28-abeb-520901a3a153@intel.com> (raw)
In-Reply-To: <6d79c82023fd7e3c4b2da6ac92ecf478366e8dca.1717337525.git.christophe.jaillet@wanadoo.fr>
On 02.06.2024 16:18, Christophe JAILLET wrote:
> 'struct devlink_dpipe_table_ops' are not modified in this driver.
>
> Constifying these structures moves some data to a read-only section, so
> increase overall security.
>
> On a x86_64, with allmodconfig:
> Before:
> ======
> text data bss dec hex filename
> 15557 712 0 16269 3f8d drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.o
>
> After:
> =====
> text data bss dec hex filename
> 15789 488 0 16277 3f95 drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c
> index ca80af06465f..fa6eddd27ecf 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c
> @@ -283,7 +283,7 @@ static u64 mlxsw_sp_dpipe_table_erif_size_get(void *priv)
> return MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS);
> }
>
> -static struct devlink_dpipe_table_ops mlxsw_sp_erif_ops = {
> +static const struct devlink_dpipe_table_ops mlxsw_sp_erif_ops = {
> .matches_dump = mlxsw_sp_dpipe_table_erif_matches_dump,
> .actions_dump = mlxsw_sp_dpipe_table_erif_actions_dump,
> .entries_dump = mlxsw_sp_dpipe_table_erif_entries_dump,
> @@ -734,7 +734,7 @@ static u64 mlxsw_sp_dpipe_table_host4_size_get(void *priv)
> return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET);
> }
>
> -static struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = {
> +static const struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = {
> .matches_dump = mlxsw_sp_dpipe_table_host4_matches_dump,
> .actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
> .entries_dump = mlxsw_sp_dpipe_table_host4_entries_dump,
> @@ -811,7 +811,7 @@ static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv)
> return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET6);
> }
>
> -static struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {
> +static const struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {
> .matches_dump = mlxsw_sp_dpipe_table_host6_matches_dump,
> .actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
> .entries_dump = mlxsw_sp_dpipe_table_host6_entries_dump,
> @@ -1230,7 +1230,7 @@ mlxsw_sp_dpipe_table_adj_size_get(void *priv)
> return size;
> }
>
> -static struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = {
> +static const struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = {
> .matches_dump = mlxsw_sp_dpipe_table_adj_matches_dump,
> .actions_dump = mlxsw_sp_dpipe_table_adj_actions_dump,
> .entries_dump = mlxsw_sp_dpipe_table_adj_entries_dump,
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
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 [this message]
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=49b0247f-f2df-4b28-abeb-520901a3a153@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).