patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: dev@dpdk.org
Cc: Matan Azrad <matan@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Michael Baum <michaelba@mellanox.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH 5/5] common/mlx5: fix flex parser creation error flow
Date: Wed, 11 Nov 2020 07:36:48 +0000
Message-ID: <1605080208-12165-5-git-send-email-michaelba@nvidia.com> (raw)
In-Reply-To: <1605080208-12165-1-git-send-email-michaelba@nvidia.com>

From: Michael Baum <michaelba@mellanox.com>

The mlx5_devx_cmd_create_flex_parser function defines a local array
(with constant size) named in, and then allocates a pointer to
mlx5_devx_obj structure by the mlx5_malloc function.

If the allocation fails, the function releases the array in and returns
NULL. However, the array has been defined locally on the stack and the
mlx5_free function is not required to release it.

Remove the call to the mlx5_free function.

Fixes: 66914d19d135 ("common/mlx5: convert control path memory to unified malloc")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 5998c4b..9c1d188 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -530,15 +530,13 @@ struct mlx5_devx_obj *
 	void *sample = MLX5_ADDR_OF(parse_graph_flex, flex, sample_table);
 	void *in_arc = MLX5_ADDR_OF(parse_graph_flex, flex, input_arc);
 	void *out_arc = MLX5_ADDR_OF(parse_graph_flex, flex, output_arc);
-	struct mlx5_devx_obj *parse_flex_obj = NULL;
+	struct mlx5_devx_obj *parse_flex_obj = mlx5_malloc
+		     (MLX5_MEM_ZERO, sizeof(*parse_flex_obj), 0, SOCKET_ID_ANY);
 	uint32_t i;
 
-	parse_flex_obj = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*parse_flex_obj), 0,
-				     SOCKET_ID_ANY);
 	if (!parse_flex_obj) {
-		DRV_LOG(ERR, "Failed to allocate flex parser data");
+		DRV_LOG(ERR, "Failed to allocate flex parser data.");
 		rte_errno = ENOMEM;
-		mlx5_free(in);
 		return NULL;
 	}
 	MLX5_SET(general_obj_in_cmd_hdr, hdr, opcode,
-- 
1.8.3.1


  parent reply	other threads:[~2020-11-11  7:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  7:36 [dpdk-stable] [PATCH 1/5] net/mlx5: fix unused calculation in RSS expansion Michael Baum
2020-11-11  7:36 ` [dpdk-stable] [PATCH 4/5] net/mlx5: fix compiler code arrangement in probe Michael Baum
2020-11-11  7:36 ` Michael Baum [this message]
2020-11-13 22:26 ` [dpdk-stable] [dpdk-dev] [PATCH 1/5] net/mlx5: fix unused calculation in RSS expansion Thomas Monjalon

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=1605080208-12165-5-git-send-email-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=michaelba@mellanox.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git