* [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer deref for traffic management CLI
@ 2017-10-27 9:10 Jasvinder Singh
2017-11-07 6:07 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Jasvinder Singh @ 2017-10-27 9:10 UTC (permalink / raw)
To: dev; +Cc: john.mcnamara
Malloc() function might returns NULL when memory allocation fails
due to insufficient space. Therefore, check for handling memory allocation
failure is added.
Coverity issue: 198442,198444
Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and hierarchy commit")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
app/test-pmd/cmdline_tm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 964ce9d..b737f8a 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1615,6 +1615,11 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
sizeof(uint32_t));
+ if (shared_shaper_id == NULL) {
+ printf(" Memory not allocated for shared shapers (error)\n");
+ return;
+ }
+
/* Parse multi shared shaper id string */
ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
if (ret) {
@@ -1770,6 +1775,11 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
sizeof(uint32_t));
+ if (shared_shaper_id == NULL) {
+ printf(" Memory not allocated for shared shapers (error)\n");
+ return;
+ }
+
/* Parse multi shared shaper id string */
ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
if (ret) {
--
2.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer deref for traffic management CLI
2017-10-27 9:10 [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer deref for traffic management CLI Jasvinder Singh
@ 2017-11-07 6:07 ` Ferruh Yigit
2017-11-07 6:11 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2017-11-07 6:07 UTC (permalink / raw)
To: Jasvinder Singh, dev; +Cc: john.mcnamara
On 10/27/2017 2:10 AM, Jasvinder Singh wrote:
> Malloc() function might returns NULL when memory allocation fails
> due to insufficient space. Therefore, check for handling memory allocation
> failure is added.
>
> Coverity issue: 198442,198444
> Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and hierarchy commit")
>
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer deref for traffic management CLI
2017-11-07 6:07 ` Ferruh Yigit
@ 2017-11-07 6:11 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-11-07 6:11 UTC (permalink / raw)
To: Jasvinder Singh, dev; +Cc: john.mcnamara
On 11/6/2017 10:07 PM, Ferruh Yigit wrote:
> On 10/27/2017 2:10 AM, Jasvinder Singh wrote:
>> Malloc() function might returns NULL when memory allocation fails
>> due to insufficient space. Therefore, check for handling memory allocation
>> failure is added.
>>
>> Coverity issue: 198442,198444
>> Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and hierarchy commit")
>>
>> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-07 6:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 9:10 [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer deref for traffic management CLI Jasvinder Singh
2017-11-07 6:07 ` Ferruh Yigit
2017-11-07 6:11 ` Ferruh Yigit
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).