DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue
@ 2018-01-22 15:45 Jasvinder Singh
  2018-01-31 22:29 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Jasvinder Singh @ 2018-01-22 15:45 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, john.mcnamara

Calloc() function might returns NULL due to insufficient space. Therefore,
check for handling memory allocation failure is added.

Coverity issue: 257030
Fixes: 5b590fbe09b6 ("app/testpmd: add traffic management forwarding mode")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test-pmd/tm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/test-pmd/tm.c b/app/test-pmd/tm.c
index b76335c..7231552 100644
--- a/app/test-pmd/tm.c
+++ b/app/test-pmd/tm.c
@@ -575,6 +575,10 @@ softport_tm_tc_node_add(portid_t port_id, struct tm_hierarchy *h,
 				tc_parent_node_id = h->pipe_node_id[i][j];
 				tnp.shared_shaper_id =
 					(uint32_t *)calloc(1, sizeof(uint32_t));
+				if (tnp.shared_shaper_id == NULL) {
+					printf("Shared shaper mem alloc err\n");
+					return -1;
+				}
 				tnp.shared_shaper_id[0] = k;
 				pos = j + (i * PIPE_NODES_PER_SUBPORT);
 				h->tc_node_id[pos][k] =
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue
  2018-01-22 15:45 [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue Jasvinder Singh
@ 2018-01-31 22:29 ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-01-31 22:29 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev, jingjing.wu, john.mcnamara

22/01/2018 16:45, Jasvinder Singh:
> Calloc() function might returns NULL due to insufficient space. Therefore,
> check for handling memory allocation failure is added.
> 
> Coverity issue: 257030
> Fixes: 5b590fbe09b6 ("app/testpmd: add traffic management forwarding mode")
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>

Applied, thanks

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue
  2018-01-22 15:15 Jasvinder Singh
@ 2018-01-31 22:27 ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-01-31 22:27 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev, jingjing.wu, john.mcnamara

22/01/2018 16:15, Jasvinder Singh:
> Malloc() function might return NULL due to insufficient space. Therefore,
> check for handling memory allocation failure is added.
> 
> Coverity issue: 257039
> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>

Applied, thanks

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

* [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue
@ 2018-01-22 15:15 Jasvinder Singh
  2018-01-31 22:27 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Jasvinder Singh @ 2018-01-22 15:15 UTC (permalink / raw)
  To: dev; +Cc: jingjing.wu, john.mcnamara

Malloc() function might return NULL due to insufficient space. Therefore,
check for handling memory allocation failure is added.

Coverity issue: 257039
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test-pmd/cmdline_mtr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 96a851b..f908fb3 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -86,6 +86,8 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 	/* Allocate memory for dscp table */
 	dscp_table = (enum rte_mtr_color *)malloc(MAX_DSCP_TABLE_ENTRIES *
 		sizeof(enum rte_mtr_color));
+	if (dscp_table == NULL)
+		return -1;
 
 	while (1) {
 		if (strcmp(token, "G") == 0 ||
@@ -105,8 +107,10 @@ parse_dscp_table_entries(char *str, enum rte_mtr_color *dscp_table)
 			break;
 
 		token = strtok_r(str, PARSE_DELIMITER, &str);
-		if (token == NULL)
+		if (token == NULL) {
+			free(dscp_table);
 			return -1;
+		}
 	}
 	return 0;
 }
-- 
2.9.3

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

end of thread, other threads:[~2018-01-31 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 15:45 [dpdk-dev] [PATCH] app/testpmd: fix dereference null return valiue Jasvinder Singh
2018-01-31 22:29 ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2018-01-22 15:15 Jasvinder Singh
2018-01-31 22:27 ` Thomas Monjalon

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