* [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
@ 2015-12-11 11:29 ` Fan Zhang
2015-12-11 15:37 ` Mcnamara, John
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error Fan Zhang
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Fan Zhang @ 2015-12-11 11:29 UTC (permalink / raw)
To: dev
Coverity issue: 107133
Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization parameters")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bc6d6d9..5bcb420 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -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;
--
2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect Fan Zhang
@ 2015-12-11 15:37 ` Mcnamara, John
2015-12-11 16:16 ` Richardson, Bruce
0 siblings, 1 reply; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 15:37 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size
> buffer defect
>
> Coverity issue: 107133
> Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization
> parameters")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> examples/ip_pipeline/init.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
> index bc6d6d9..5bcb420 100644
> --- a/examples/ip_pipeline/init.c
> +++ b/examples/ip_pipeline/init.c
> @@ -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;
>
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.
--
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect
2015-12-11 15:37 ` Mcnamara, John
@ 2015-12-11 16:16 ` Richardson, Bruce
0 siblings, 0 replies; 14+ messages in thread
From: Richardson, Bruce @ 2015-12-11 16:16 UTC (permalink / raw)
To: Mcnamara, John, Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Mcnamara, John
> Sent: Friday, December 11, 2015 3:37 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed
> size buffer defect
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> > Sent: Friday, December 11, 2015 11:29 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed
> > size buffer defect
> >
> > Coverity issue: 107133
> > Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization
> > parameters")
> >
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > ---
> > examples/ip_pipeline/init.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
> > index bc6d6d9..5bcb420 100644
> > --- a/examples/ip_pipeline/init.c
> > +++ b/examples/ip_pipeline/init.c
> > @@ -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;
> >
>
> 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.
> --
Use snprintf to avoid having to explicitly null terminate, perhaps?
/Bruce
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect Fan Zhang
@ 2015-12-11 11:29 ` Fan Zhang
2015-12-11 15:20 ` Mcnamara, John
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect Fan Zhang
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Fan Zhang @ 2015-12-11 11:29 UTC (permalink / raw)
To: dev
Coverity issue: 107104
Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/config_parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index 67e58c9..dbeb3a9 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -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 =");
--
2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error Fan Zhang
@ 2015-12-11 15:20 ` Mcnamara, John
0 siblings, 0 replies; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 15:20 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error
>
> Coverity issue: 107104
> Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect Fan Zhang
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix copy-paste error Fan Zhang
@ 2015-12-11 11:29 ` Fan Zhang
2015-12-11 15:22 ` Mcnamara, John
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect Fan Zhang
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Fan Zhang @ 2015-12-11 11:29 UTC (permalink / raw)
To: dev
Coverity issue: 107109
Fixes: 7122d30131ad ("examples/ip_pipeline: rework flow classification pipeline")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/pipeline/pipeline_flow_classification.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
index 76a152f..1921574 100644
--- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
+++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c
@@ -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);
--
2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect Fan Zhang
@ 2015-12-11 15:22 ` Mcnamara, John
0 siblings, 0 replies; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 15:22 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode
> defect
>
> Coverity issue: 107109
> Fixes: 7122d30131ad ("examples/ip_pipeline: rework flow classification
> pipeline")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
` (2 preceding siblings ...)
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix logically deadnode defect Fan Zhang
@ 2015-12-11 11:29 ` Fan Zhang
2015-12-11 15:25 ` Mcnamara, John
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite Fan Zhang
2015-12-11 14:59 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Mcnamara, John
5 siblings, 1 reply; 14+ messages in thread
From: Fan Zhang @ 2015-12-11 11:29 UTC (permalink / raw)
To: dev
Coverity issue: 107127
Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/config_parse_tm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ip_pipeline/config_parse_tm.c b/examples/ip_pipeline/config_parse_tm.c
index cdebbdc..84702b0 100644
--- a/examples/ip_pipeline/config_parse_tm.c
+++ b/examples/ip_pipeline/config_parse_tm.c
@@ -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;
--
2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect Fan Zhang
@ 2015-12-11 15:25 ` Mcnamara, John
0 siblings, 0 replies; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 15:25 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer
> defect
>
> Coverity issue: 107127
> Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Thanks for updating the Coverity Triage for these issues.
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
` (3 preceding siblings ...)
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix overrunning byffer defect Fan Zhang
@ 2015-12-11 11:29 ` Fan Zhang
2015-12-11 15:44 ` Mcnamara, John
2015-12-11 14:59 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Mcnamara, John
5 siblings, 1 reply; 14+ messages in thread
From: Fan Zhang @ 2015-12-11 11:29 UTC (permalink / raw)
To: dev
Coverity issue: 107136
Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/config_parse.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index 67e58c9..4e194d6 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -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);
--
2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite Fan Zhang
@ 2015-12-11 15:44 ` Mcnamara, John
0 siblings, 0 replies; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 15:44 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite
>
> Coverity issue: 107136
> Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning
2015-12-11 11:29 [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning Fan Zhang
` (4 preceding siblings ...)
2015-12-11 11:29 ` [dpdk-dev] [PATCH] example/ip_pipeline: fix value overwrite Fan Zhang
@ 2015-12-11 14:59 ` Mcnamara, John
2015-12-13 1:34 ` Thomas Monjalon
5 siblings, 1 reply; 14+ messages in thread
From: Mcnamara, John @ 2015-12-11 14:59 UTC (permalink / raw)
To: Zhang, Roy Fan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Friday, December 11, 2015 11:29 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix buffer size warning
>
> Coverity issue: 107102
> Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")
>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread