netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>,
	"Colin Ian King" <colin.king@canonical.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 1/4] net/mlx5: Fix uininitialized pointer read on pointer attr
Date: Mon, 12 Oct 2020 15:41:49 -0700	[thread overview]
Message-ID: <20201012224152.191479-2-saeedm@nvidia.com> (raw)
In-Reply-To: <20201012224152.191479-1-saeedm@nvidia.com>

From: Colin Ian King <colin.king@canonical.com>

Currently the error exit path err_free kfree's attr. In the case where
flow and parse_attr failed to be allocated this return path will free
the uninitialized pointer attr, which is not correct.  In the other
case where attr fails to allocate attr does not need to be freed. So
in both error exits via err_free attr should not be freed, so remove
it.

Addresses-Coverity: ("Uninitialized pointer read")
Fixes: ff7ea04ad579 ("net/mlx5e: Fix potential null pointer dereference")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 -
 1 file changed, 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 a0c356987e1a..e3a968e9e2a0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4569,7 +4569,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
 err_free:
 	kfree(flow);
 	kvfree(parse_attr);
-	kfree(attr);
 	return err;
 }
 
-- 
2.26.2


  reply	other threads:[~2020-10-12 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 22:41 [pull request][net-next 0/4] mlx5 updates 2020-10-12 Saeed Mahameed
2020-10-12 22:41 ` Saeed Mahameed [this message]
2020-10-12 22:41 ` [net-next 2/4] net/mlx5: Add NIC TX domain namespace Saeed Mahameed
2020-10-12 22:41 ` [net-next 3/4] net/mlx5e: IPsec: Add TX steering rule per IPsec state Saeed Mahameed
2020-10-12 22:41 ` [net-next 4/4] net/mlx5e: IPsec: Add Connect-X IPsec Tx data path offload Saeed Mahameed
2020-10-14  3:03 ` [pull request][net-next 0/4] mlx5 updates 2020-10-12 Jakub Kicinski

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=20201012224152.191479-2-saeedm@nvidia.com \
    --to=saeedm@nvidia.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).