From: Jasvinder Singh Date: Mon, 22 Jan 2018 15:45:53 +0000 (+0000) Subject: app/testpmd: fix allocation check in TM config X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9e70fce2e1cfb5f5061272b3051c5a95cf0a1ef5;p=dpdk.git app/testpmd: fix allocation check in TM config 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") Cc: stable@dpdk.org Signed-off-by: Jasvinder Singh --- diff --git a/app/test-pmd/tm.c b/app/test-pmd/tm.c index b76335c161..7231552a41 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] =