netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Roy Novich <royno@nvidia.com>, Aya Levin <ayal@nvidia.com>
Subject: [net 4/7] net/mlx5e: Initialize link speed to zero
Date: Tue, 21 Mar 2023 14:11:32 -0700	[thread overview]
Message-ID: <20230321211135.47711-5-saeed@kernel.org> (raw)
In-Reply-To: <20230321211135.47711-1-saeed@kernel.org>

From: Roy Novich <royno@nvidia.com>

mlx5e_port_max_linkspeed does not guarantee value assignment for speed.
Avoid cases where link_speed might be used uninitialized. In case
mlx5e_port_max_linkspeed fails, a default link speed of 50000 will be
used for the calculations.

Fixes: 3f6d08d196b2 ("net/mlx5e: Add RSS support for hairpin")
Signed-off-by: Roy Novich <royno@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 6bfed633343a..87a2850b32d0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1103,8 +1103,8 @@ static void
 mlx5e_hairpin_params_init(struct mlx5e_hairpin_params *hairpin_params,
 			  struct mlx5_core_dev *mdev)
 {
+	u32 link_speed = 0;
 	u64 link_speed64;
-	u32 link_speed;
 
 	hairpin_params->mdev = mdev;
 	/* set hairpin pair per each 50Gbs share of the link */
-- 
2.39.2


  parent reply	other threads:[~2023-03-21 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 21:11 [pull request][net 0/7] mlx5 fixes 2023-03-21 Saeed Mahameed
2023-03-21 21:11 ` [net 1/7] net/mlx5e: Set uplink rep as NETNS_LOCAL Saeed Mahameed
2023-03-23  6:00   ` patchwork-bot+netdevbpf
2023-03-21 21:11 ` [net 2/7] net/mlx5e: Block entering switchdev mode with ns inconsistency Saeed Mahameed
2023-03-21 21:11 ` [net 3/7] net/mlx5: Fix steering rules cleanup Saeed Mahameed
2023-03-21 21:11 ` Saeed Mahameed [this message]
2023-03-21 21:11 ` [net 5/7] net/mlx5e: Overcome slow response for first macsec ASO WQE Saeed Mahameed
2023-03-21 21:11 ` [net 6/7] net/mlx5: Read the TC mapping of all priorities on ETS query Saeed Mahameed
2023-03-21 21:11 ` [net 7/7] net/mlx5: E-Switch, Fix an Oops in error handling code Saeed Mahameed

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=20230321211135.47711-5-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=ayal@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=royno@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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).