All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: netdev@vger.kernel.org, saeedm@nvidia.com, tariqt@nvidia.com,
	mbloch@nvidia.com, jserv@ccns.ncku.edu.tw,
	charlie910417@gmail.com
Subject: Re: [PATCH 1/1] net/mlx5/core: Allocate ttc_params on heap
Date: Thu, 26 Feb 2026 12:05:14 +0200	[thread overview]
Message-ID: <20260226100514.GH12611@unreal> (raw)
In-Reply-To: <20260226092857.1583984-2-yphbchou0911@gmail.com>

On Thu, Feb 26, 2026 at 05:28:55PM +0800, Cheng-Yang Chou wrote:
> The ttc_params structure is too large to be allocated on the stack,
> triggering warnings for exceeding the 1024-byte frame size limit.
> Consuming excessive stack space risks causing stack overflows.
> 
> Allocate the structure dynamically to maintain safe stack boundaries.
> 
> Signed-off-by: Po-Ying Chiu <charlie910417@gmail.com>
> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
>  .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 15 +++++++++----
>  .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 15 ++++++++++---
>  .../mellanox/mlx5/core/lag/port_sel.c         | 22 ++++++++++++++-----
>  3 files changed, 39 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> index 6eec88fa6d10..8e3862f5b563 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> @@ -966,27 +966,34 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
>  {
>  	struct mlx5e_rep_priv *rpriv = priv->ppriv;
>  	struct mlx5_eswitch_rep *rep = rpriv->rep;
> -	struct ttc_params ttc_params = {};
> +	struct ttc_params *ttc_params;
>  	int err;
>  
> +	ttc_params = kzalloc(sizeof(*ttc_params), GFP_KERNEL);

It needs to be kzalloc_obj(*ttc_params).
https://lore.kernel.org/linux-rdma/20260226071913.GD12611@unreal/T/#u

Thanks

  reply	other threads:[~2026-02-26 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  9:28 [PATCH 0/1] net/mlx5/core: Fix stack frame size warnings Cheng-Yang Chou
2026-02-26  9:28 ` [PATCH 1/1] net/mlx5/core: Allocate ttc_params on heap Cheng-Yang Chou
2026-02-26 10:05   ` Leon Romanovsky [this message]
2026-02-26 10:33     ` Cheng-Yang Chou
2026-02-26 18:15   ` Simon Horman
2026-02-27  2:38     ` Cheng-Yang Chou

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=20260226100514.GH12611@unreal \
    --to=leon@kernel.org \
    --cc=charlie910417@gmail.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=yphbchou0911@gmail.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.