example/ip_pipeline: fix buffer size warning
PATCH 1/1 example/ip_pipeline: fix buffer size warning
Coverity issue: 107102
--- examples/ip_pipeline/config_parse_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ip_pipeline/config_parse_tm.c +1 -1
@@ -349,7 +349,7 @@ tm_cfgfile_load_sched_subport(char *tokens[2 ] = {NULL ,NULL };int n_tokens;int begin, end; -char name[CFG_NAME_LEN ]; +char name[CFG_NAME_LEN +1 ]; profile =atoi (entries[j].value); strncpy(name,
Signature · 1 line
2.5.0
PATCH 1/1 example/ip_pipeline: fix copy into fixed size buffer defect
Coverity issue: 107133
--- examples/ip_pipeline/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
examples/ip_pipeline/init.c +4 -1
@@ -1068,7 +1068,10 @@ static void app_pipeline_params_get(struct app_params *app,uint32_t i;uint32_t mempool_id; -strcpy (p_out->name, p_in->name); +if (sizeof (p_in->name) >PIPELINE_NAME_SIZE ) +strncpy (p_out->name, p_in->name,PIPELINE_NAME_SIZE ); +else +strcpy (p_out->name, p_in->name); p_out->socket_id = (int ) p_in->socket_id;
Signature · 1 line
2.5.0
Re: [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect
Quoted 24 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defectCoverity issue: 107133
Fixes eb32fe7c5574 ("examples/ip_pipeline: rework initializationparameters")
Signed-off-by Fan Zhang <[email protected]>--- examples/ip_pipeline/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)examples/ip_pipeline/init.c +0
-0@@ -1068,7 +1068,10 @@ static void app_pipeline_params_get(struct app_params *app,
examples/ip_pipeline/init.c static void app_pipeline_params_get(struct · line 1077
Quoted 10 lines
examples/ip_pipeline/init.c +4
-1uint32_t i;uint32_t mempool_id; -strcpy (p_out->name, p_in->name); +if (sizeof (p_in->name) >PIPELINE_NAME_SIZE ) +strncpy (p_out->name, p_in->name,PIPELINE_NAME_SIZE ); +else +strcpy (p_out->name, p_in->name); p_out->socket_id = (int ) p_in->socket_id;
Hi Fan,
I think there could still be issues here (depending of the size/types of p_out->name and p_in->name). Probably better as something like:
strncpy(p_out->name, p_in->name, PIPELINE_NAME_SIZE);
p_out->name[PIPELINE_NAME_SIZE -1] = '\0'; John.
Re: [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect
Quoted 46 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Mcnamara, John
Sent: Friday, December 11, 2015 3:37 PM
To: Zhang, Roy Fan <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defectQuoted 24 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defectCoverity issue: 107133
Fixes eb32fe7c5574 ("examples/ip_pipeline: rework initializationparameters")
Signed-off-by Fan Zhang <[email protected]>--- examples/ip_pipeline/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)examples/ip_pipeline/init.c +0
-0@@ -1068,7 +1068,10 @@ static void app_pipeline_params_get(struct app_params *app,examples/ip_pipeline/init.c static void app_pipeline_params_get(struct · line 1077
Quoted 10 lines
examples/ip_pipeline/init.c +4
-1uint32_t i;uint32_t mempool_id; -strcpy (p_out->name, p_in->name); +if (sizeof (p_in->name) >PIPELINE_NAME_SIZE ) +strncpy (p_out->name, p_in->name,PIPELINE_NAME_SIZE ); +else +strcpy (p_out->name, p_in->name); p_out->socket_id = (int ) p_in->socket_id;Hi Fan,
Quoted 8 lines
I think there could still be issues here (depending of the size/types of
p_out->nameandp_in->name). Probably better as something like:strncpy(p_out->name, p_in->name, PIPELINE_NAME_SIZE); p_out->name[PIPELINE_NAME_SIZE -1] = '\0';John.
--
Use snprintf to avoid having to explicitly null terminate, perhaps? /Bruce
PATCH 1/1 example/ip_pipeline: fix copy-paste error
In reply to Fan ZhangCoverity issue: 107104
--- examples/ip_pipeline/config_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ip_pipeline/config_parse.c +1 -1
@@ -2398,7 +2398,7 @@ save_pipeline_params(struct app_params *app, FILE *f) }/* msgq_out */ -if (p->n_msgq_in) { +if (p->n_msgq_out) {uint32_t j;fprintf (f,"msgq_out =" );
Signature · 1 line
2.5.0
Re: [PATCH] example/ip_pipeline: fix copy-paste error
Quoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste errorCoverity issue: 107104
Fixes 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")Signed-off-by Fan Zhang <[email protected]>
PATCH 1/1 example/ip_pipeline: fix logically deadnode defect
In reply to Fan ZhangCoverity issue: 107109
--- examples/ip_pipeline/pipeline/pipeline_flow_classification.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ip_pipeline/pipeline/pipeline_flow_classification.c +1 -1
@@ -448,7 +448,7 @@ app_pipeline_fc_add_bulk(struct app_params *app, flow_rsp =rte_malloc (NULL , n_keys *sizeof (struct pipeline_fc_add_bulk_flow_rsp ),RTE_CACHE_LINE_SIZE ); -if (flow_req ==NULL ) { +if (flow_rsp ==NULL ) {rte_free (flow_req);rte_free (new_flow);rte_free (signature);
Signature · 1 line
2.5.0
Re: [PATCH] example/ip_pipeline: fix logically deadnode defect
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect
Quoted 6 lines
Coverity issue: 107109
Fixes 7122d30131ad ("examples/ip_pipeline: rework flow classificationpipeline")
Signed-off-by Fan Zhang <[email protected]>
PATCH 1/1 example/ip_pipeline: fix overrunning byffer defect
In reply to Fan ZhangCoverity issue: 107127
--- examples/ip_pipeline/config_parse_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ip_pipeline/config_parse_tm.c +1 -1
@@ -399,7 +399,7 @@ tm_cfgfile_load(struct app_pktq_tm_params *tm)memset (tm->sched_subport_params,0 ,sizeof (tm->sched_subport_params));memset (tm->sched_pipe_profiles,0 ,sizeof (tm->sched_pipe_profiles)); -memset (&tm->sched_port_params,0 ,sizeof (tm->sched_pipe_profiles)); +memset (&tm->sched_port_params,0 ,sizeof (tm->sched_port_params));for (i =0 ; i <APP_MAX_SCHED_SUBPORTS *APP_MAX_SCHED_PIPES ; i++) tm->sched_pipe_to_profile[i] =-1 ;
Signature · 1 line
2.5.0
Re: [PATCH] example/ip_pipeline: fix overrunning byffer defect
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect
Quoted 5 lines
Coverity issue: 107127
Fixes 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")Signed-off-by Fan Zhang <[email protected]>
Thanks for updating the Coverity Triage for these issues.
PATCH 1/1 example/ip_pipeline: fix value overwrite
In reply to Fan ZhangCoverity issue: 107136
--- examples/ip_pipeline/config_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ip_pipeline/config_parse.c +2 -2
@@ -1631,8 +1631,8 @@ parse_tm(struct app_params *app, param->file_name =strdup (ent->value);if (param->file_name ==NULL ) ret = -EINVAL ; - - ret =0 ; +else + ret =0 ; }else if (strcmp (ent->name,"burst_read" ) ==0 ) ret =parser_read_uint32 (¶m->burst_read, ent->value);
Signature · 1 line
2.5.0
Re: [PATCH] example/ip_pipeline: fix value overwrite
Quoted 8 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite
Quoted 5 lines
Coverity issue: 107136
Fixes 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")Signed-off-by Fan Zhang <[email protected]>
Quoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Friday, December 11, 2015 11:29 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warningCoverity issue: 107102
Fixes 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")Signed-off-by Fan Zhang <[email protected]>
Quoted 7 lines
Quoted 5 lines
Coverity issue: 107102
Fixes 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")Signed-off-by Fan Zhang <[email protected]>Acked-by John McNamara <[email protected]>
Series applied, thanks
(Not really a series but threaded like it)