public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Bloch <mbloch@nvidia.com>
To: Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>
Cc: Tariq Toukan <tariqt@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	"Saeed Mahameed" <saeedm@nvidia.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Gal Pressman <gal@nvidia.com>,
	<linux-rdma@vger.kernel.org>, Lama Kayal <lkayal@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Vlad Dogaru <vdogaru@nvidia.com>
Subject: [PATCH net V2 03/11] net/mlx5: HWS, Fix uninitialized variables in mlx5hws_pat_calc_nop error flow
Date: Mon, 25 Aug 2025 17:34:26 +0300	[thread overview]
Message-ID: <20250825143435.598584-4-mbloch@nvidia.com> (raw)
In-Reply-To: <20250825143435.598584-1-mbloch@nvidia.com>

From: Lama Kayal <lkayal@nvidia.com>

In mlx5hws_pat_calc_nop(), src_field and dst_field are passed to
hws_action_modify_get_target_fields() which should set their values.
However, if an invalid action type is encountered, these variables
remain uninitialized and are later used to update prev_src_field
and prev_dst_field.

Initialize both variables to INVALID_FIELD to ensure they have
defined values in all code paths.

Fixes: 01e035fd0380 ("net/mlx5: HWS, handle modify header actions dependency")
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
index 51e4c551e0ef..622fd579f140 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
@@ -527,7 +527,6 @@ int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions,
 			 u32 *nop_locations, __be64 *new_pat)
 {
 	u16 prev_src_field = INVALID_FIELD, prev_dst_field = INVALID_FIELD;
-	u16 src_field, dst_field;
 	u8 action_type;
 	bool dependent;
 	size_t i, j;
@@ -539,6 +538,9 @@ int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions,
 		return 0;
 
 	for (i = 0, j = 0; i < num_actions; i++, j++) {
+		u16 src_field = INVALID_FIELD;
+		u16 dst_field = INVALID_FIELD;
+
 		if (j >= max_actions)
 			return -EINVAL;
 
-- 
2.34.1


  parent reply	other threads:[~2025-08-25 14:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 14:34 [PATCH net V2 00/11] mlx5 misc fixes 2025-08-25 Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 01/11] net/mlx5: HWS, Fix memory leak in hws_pool_buddy_init error path Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 02/11] net/mlx5: HWS, Fix memory leak in hws_action_get_shared_stc_nic error flow Mark Bloch
2025-08-25 14:34 ` Mark Bloch [this message]
2025-08-25 14:34 ` [PATCH net V2 04/11] net/mlx5: HWS, Fix pattern destruction in mlx5hws_pat_get_pattern error path Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 05/11] net/mlx5: Reload auxiliary drivers on fw_activate Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 06/11] net/mlx5: Fix lockdep assertion on sync reset unload event Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 07/11] net/mlx5: Nack sync reset when SFs are present Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 08/11] net/mlx5: Prevent flow steering mode changes in switchdev mode Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 09/11] net/mlx5e: Update and set Xon/Xoff upon MTU set Mark Bloch
2025-08-25 14:34 ` [PATCH net V2 10/11] net/mlx5e: Update and set Xon/Xoff upon port speed set Mark Bloch
2025-09-11  0:00   ` Jakub Kicinski
2025-09-11 13:47     ` Jakub Kicinski
2025-09-11 14:25       ` Mark Bloch
2025-09-11 14:36         ` Jakub Kicinski
2025-09-15  7:38           ` Tariq Toukan
2025-09-17 10:39             ` Tariq Toukan
2025-09-17 13:00               ` Daniel Zahka
2025-09-17 13:38                 ` Tariq Toukan
2025-08-25 14:34 ` [PATCH net V2 11/11] net/mlx5e: Set local Xoff after FW update Mark Bloch
2025-08-27  1:10 ` [PATCH net V2 00/11] mlx5 misc fixes 2025-08-25 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=20250825143435.598584-4-mbloch@nvidia.com \
    --to=mbloch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lkayal@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vdogaru@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