DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue
@ 2020-10-06 20:37 Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update Cristian Dumitrescu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")
Coverity issue: 362741

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_ctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c
index 576fb2bf3..9d986a83e 100644
--- a/lib/librte_pipeline/rte_swx_ctl.c
+++ b/lib/librte_pipeline/rte_swx_ctl.c
@@ -1463,6 +1463,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 		arg_offset += arg->n_bits / 8;
 	}
 
+	free(s0);
 	return entry;
 
 error:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 3/7] pipeline: fix argument check Cristian Dumitrescu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Coverity issues: 362744, 362745, 362882

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/pipeline/cli.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 9f3d87a3c..76a58ee28 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -836,8 +836,8 @@ cmd_pipeline_table_update(char **tokens,
 	}
 
 	if (strcmp(file_name_delete, "none")) {
-		file_add = fopen(file_name_delete, "r");
-		if (!file_add) {
+		file_delete = fopen(file_name_delete, "r");
+		if (!file_delete) {
 			snprintf(out, out_size, "Cannot open file %s",
 				file_name_delete);
 			goto error;
@@ -845,8 +845,8 @@ cmd_pipeline_table_update(char **tokens,
 	}
 
 	if (strcmp(file_name_default, "none")) {
-		file_add = fopen(file_name_default, "r");
-		if (!file_add) {
+		file_default = fopen(file_name_default, "r");
+		if (!file_default) {
 			snprintf(out, out_size, "Cannot open file %s",
 				file_name_default);
 			goto error;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 3/7] pipeline: fix argument check
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 4/7] pipeline: fix memory free issues Cristian Dumitrescu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")
Coverity issue: 362789

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline_spec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c
index 95de8f983..06e1ab438 100644
--- a/lib/librte_pipeline/rte_swx_pipeline_spec.c
+++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c
@@ -1064,7 +1064,7 @@ rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p,
 		goto error;
 	}
 
-	if (!p) {
+	if (!spec) {
 		if (err_line)
 			*err_line = 0;
 		if (err_msg)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 4/7] pipeline: fix memory free issues
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 3/7] pipeline: fix argument check Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 5/7] pipeline: fix resource leak issue Cristian Dumitrescu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")
Coverity issues: 362796, 362804, 362819, 362836, 362858, 362865,
362869

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline_spec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c
index 06e1ab438..a4bc8226a 100644
--- a/lib/librte_pipeline/rte_swx_pipeline_spec.c
+++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c
@@ -35,9 +35,17 @@ struct extobj_spec {
 static void
 extobj_spec_free(struct extobj_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->name);
+	s->name = NULL;
+
 	free(s->extern_type_name);
+	s->extern_type_name = NULL;
+
 	free(s->pragma);
+	s->pragma = NULL;
 }
 
 static int
@@ -246,8 +254,14 @@ struct header_spec {
 static void
 header_spec_free(struct header_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->name);
+	s->name = NULL;
+
 	free(s->struct_type_name);
+	s->struct_type_name = NULL;
 }
 
 static int
@@ -297,7 +311,11 @@ struct metadata_spec {
 static void
 metadata_spec_free(struct metadata_spec *s)
 {
+	if (!s)
+		return;
+
 	free(s->struct_type_name);
+	s->struct_type_name = NULL;
 }
 
 static int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 5/7] pipeline: fix resource leak issue
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
                   ` (2 preceding siblings ...)
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 4/7] pipeline: fix memory free issues Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 6/7] pipeline: fix unused variable issue Cristian Dumitrescu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")
Coverity issue: 362812

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c
index 9d986a83e..ee6df4544 100644
--- a/lib/librte_pipeline/rte_swx_ctl.c
+++ b/lib/librte_pipeline/rte_swx_ctl.c
@@ -371,7 +371,7 @@ table_entry_duplicate(struct rte_swx_ctl_pipeline *ctl,
 		}
 	}
 
-	return entry;
+	return new_entry;
 
 error:
 	table_entry_free(new_entry);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 6/7] pipeline: fix unused variable issue
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
                   ` (3 preceding siblings ...)
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 5/7] pipeline: fix resource leak issue Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free Cristian Dumitrescu
  2020-10-08 13:07 ` [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue David Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: 75634474ca ("pipeline: add SWX instruction verifier")
Coverity issue: 362855

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index 8b7ff56f6..a4d072d6d 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -5671,7 +5671,7 @@ instr_verify(struct rte_swx_pipeline *p __rte_unused,
 		for (i = 0; i < n_instructions; i++) {
 			type = instr[i].type;
 
-			if (instr[i].type == INSTR_TX)
+			if (type == INSTR_TX)
 				break;
 		}
 		CHECK(i < n_instructions, EINVAL);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
                   ` (4 preceding siblings ...)
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 6/7] pipeline: fix unused variable issue Cristian Dumitrescu
@ 2020-10-06 20:37 ` Cristian Dumitrescu
  2020-10-08 13:07 ` [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue David Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: Cristian Dumitrescu @ 2020-10-06 20:37 UTC (permalink / raw)
  To: dev

Fixes: a1711f948d ("pipeline: add SWX Rx and extract instructions")
Coverity issue: 362901

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index a4d072d6d..d5b4a1cc6 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -5932,7 +5932,6 @@ instruction_config(struct rte_swx_pipeline *p,
 {
 	struct instruction *instr = NULL;
 	struct instruction_data *data = NULL;
-	char *string = NULL;
 	int err = 0;
 	uint32_t i;
 
@@ -5955,15 +5954,17 @@ instruction_config(struct rte_swx_pipeline *p,
 	}
 
 	for (i = 0; i < n_instructions; i++) {
-		string = strdup(instructions[i]);
+		char *string = strdup(instructions[i]);
 		if (!string) {
 			err = ENOMEM;
 			goto error;
 		}
 
 		err = instr_translate(p, a, string, &instr[i], &data[i]);
-		if (err)
+		if (err) {
+			free(string);
 			goto error;
+		}
 
 		free(string);
 	}
@@ -5982,8 +5983,6 @@ instruction_config(struct rte_swx_pipeline *p,
 	if (err)
 		goto error;
 
-	free(data);
-
 	if (a) {
 		a->instructions = instr;
 		a->n_instructions = n_instructions;
@@ -5992,10 +5991,10 @@ instruction_config(struct rte_swx_pipeline *p,
 		p->n_instructions = n_instructions;
 	}
 
+	free(data);
 	return 0;
 
 error:
-	free(string);
 	free(data);
 	free(instr);
 	return err;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue
  2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
                   ` (5 preceding siblings ...)
  2020-10-06 20:37 ` [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free Cristian Dumitrescu
@ 2020-10-08 13:07 ` David Marchand
  6 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2020-10-08 13:07 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev

On Tue, Oct 6, 2020 at 10:38 PM Cristian Dumitrescu
<cristian.dumitrescu@intel.com> wrote:
>
> Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")
> Coverity issue: 362741
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Series applied.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-08 13:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 20:37 [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 2/7] examples/pipeline: fix files for table update Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 3/7] pipeline: fix argument check Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 4/7] pipeline: fix memory free issues Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 5/7] pipeline: fix resource leak issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 6/7] pipeline: fix unused variable issue Cristian Dumitrescu
2020-10-06 20:37 ` [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free Cristian Dumitrescu
2020-10-08 13:07 ` [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue David Marchand

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).