From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/mlx5: handle errors in mlx5_chains_create_table()
Date: Wed, 5 Mar 2025 21:12:22 +0200 [thread overview]
Message-ID: <49df4e60-695a-4562-aa27-f946e7acd485@gmail.com> (raw)
In-Reply-To: <20250304080323.2237-1-vulab@iscas.ac.cn>
On 04/03/2025 10:03, Wentao Liang wrote:
> Add error handling for mlx5_get_fdb_sub_ns() and
> mlx5_get_flow_namespace() failures in mlx5_chains_create_table().
> Log error message with mlx5_core_warn() to prevent silent failures
nit: double spaces before mlx5_core_warn.
> and return immediately to prevent null pointer dereference of ns.
>
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Please add Fixes tag and target the patch to net.
> ---
> drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> index a80ecb672f33..e808531cc6f5 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> @@ -196,6 +196,11 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains,
> ns = mlx5_get_flow_namespace(chains->dev, chains->ns);
> }
>
> + if (!ns) {
> + mlx5_core_warn(chains->dev, "Failed to get flow namespace\n");
> + return NULL;
Callers expect error, not NULL.
> + }
> +
> ft_attr.autogroup.num_reserved_entries = 2;
> ft_attr.autogroup.max_num_groups = chains->group_num;
> ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
prev parent reply other threads:[~2025-03-05 19:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 8:03 Wentao Liang
2025-03-05 19:12 ` Tariq Toukan [this message]
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=49df4e60-695a-4562-aa27-f946e7acd485@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=vulab@iscas.ac.cn \
/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
all inboxes | Powered by JetHome®