* [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy @ 2018-10-30 14:22 Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 2/4] " Reshma Pattan ` (4 more replies) 0 siblings, 5 replies; 7+ messages in thread From: Reshma Pattan @ 2018-10-30 14:22 UTC (permalink / raw) To: dev; +Cc: Reshma Pattan, cristian.dumitrescu, jasvinder.singh From: Reshma Pattan <reshma.pattan@intel.com> Use strlcpy instead of strcpy to avoid buffer overrun. Coverity issue: 323514 Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") CC: cristian.dumitrescu@intel.com CC: jasvinder.singh@intel.com Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> --- drivers/net/softnic/rte_eth_softnic_cli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index c6640d658..2235b07e8 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -2096,7 +2096,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TXQ; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); if (strcmp(tokens[8], "txq") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "txq"); @@ -2117,7 +2117,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_SWQ; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "tmgr") == 0) { if (n_tokens != 8) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -2127,7 +2127,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TMGR; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "tap") == 0) { if (n_tokens != 8) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -2137,7 +2137,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TAP; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "sink") == 0) { if ((n_tokens != 7) && (n_tokens != 11)) { snprintf(out, out_size, MSG_ARG_MISMATCH, -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 2/4] net/softnic: fix string copy 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan @ 2018-10-30 14:22 ` Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 3/4] " Reshma Pattan ` (3 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Reshma Pattan @ 2018-10-30 14:22 UTC (permalink / raw) To: dev; +Cc: Reshma Pattan, cristian.dumitrescu, jasvinder.singh From: Reshma Pattan <reshma.pattan@intel.com> Replace strcpy with strlcpy to avoid buffer overrun. Coverity issue: 323515 Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") CC: cristian.dumitrescu@intel.com CC: jasvinder.singh@intel.com Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> --- drivers/net/softnic/rte_eth_softnic_cli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 2235b07e8..a0beca904 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -2485,7 +2485,8 @@ cmd_pipeline_table(struct pmd_internals *softnic, return; } - strcpy(p.action_profile_name, tokens[t0 + 1]); + strlcpy(p.action_profile_name, tokens[t0 + 1], + sizeof(p.action_profile_name)); t0 += 2; } -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/softnic: fix string copy 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 2/4] " Reshma Pattan @ 2018-10-30 14:22 ` Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 4/4] " Reshma Pattan ` (2 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Reshma Pattan @ 2018-10-30 14:22 UTC (permalink / raw) To: dev; +Cc: Reshma Pattan, cristian.dumitrescu, jasvinder.singh From: Reshma Pattan <reshma.pattan@intel.com> Use strlcpy instead of strcpy to avoid buffer overrun. Coverity issue: 323475 Fixes: c169b6a588 ("net/softnic: map flow attribute to pipeline table") CC: cristian.dumitrescu@intel.com CC: jasvinder.singh@intel.com Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> --- drivers/net/softnic/rte_eth_softnic_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index 285af462b..295bc6c83 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -56,7 +56,7 @@ flow_attr_map_set(struct pmd_internals *softnic, map = (ingress) ? &softnic->flow.ingress_map[group_id] : &softnic->flow.egress_map[group_id]; - strcpy(map->pipeline_name, pipeline_name); + strlcpy(map->pipeline_name, pipeline_name, sizeof(map->pipeline_name)); map->table_id = table_id; map->valid = 1; -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 4/4] net/softnic: fix string copy 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 2/4] " Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 3/4] " Reshma Pattan @ 2018-10-30 14:22 ` Reshma Pattan 2018-10-31 9:47 ` [dpdk-dev] [PATCH 1/4] " Thomas Monjalon 2018-10-31 10:16 ` [dpdk-dev] [PATCH v2] " Reshma Pattan 4 siblings, 0 replies; 7+ messages in thread From: Reshma Pattan @ 2018-10-30 14:22 UTC (permalink / raw) To: dev; +Cc: Reshma Pattan, cristian.dumitrescu, jasvinder.singh From: Reshma Pattan <reshma.pattan@intel.com> Use strlcpy instead of strcpy to avoid buffer overrun. Coverity issue: 323478 Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") CC: cristian.dumitrescu@intel.com CC: jasvinder.singh@intel.com Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> --- drivers/net/softnic/rte_eth_softnic_cli.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index a0beca904..57b623377 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -1867,7 +1867,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_RXQ; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); if (strcmp(tokens[t0 + 2], "rxq") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rxq"); @@ -1890,7 +1890,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_SWQ; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); t0 += 2; } else if (strcmp(tokens[t0], "tmgr") == 0) { @@ -1902,7 +1902,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_TMGR; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); t0 += 2; } else if (strcmp(tokens[t0], "tap") == 0) { @@ -1914,7 +1914,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_TAP; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); if (strcmp(tokens[t0 + 2], "mempool") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, @@ -2009,7 +2009,8 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, return; } - strcpy(p.action_profile_name, tokens[t0 + 1]); + strlcpy(p.action_profile_name, tokens[t0 + 1], + sizeof(p.action_profile_name)); t0 += 2; } -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan ` (2 preceding siblings ...) 2018-10-30 14:22 ` [dpdk-dev] [PATCH 4/4] " Reshma Pattan @ 2018-10-31 9:47 ` Thomas Monjalon 2018-10-31 10:16 ` [dpdk-dev] [PATCH v2] " Reshma Pattan 4 siblings, 0 replies; 7+ messages in thread From: Thomas Monjalon @ 2018-10-31 9:47 UTC (permalink / raw) To: Reshma Pattan; +Cc: dev, cristian.dumitrescu, jasvinder.singh Hi Reshma, 30/10/2018 15:22, Reshma Pattan: > From: Reshma Pattan <reshma.pattan@intel.com> > > Use strlcpy instead of strcpy to avoid buffer overrun. > > Coverity issue: 323514 > > Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") > CC: cristian.dumitrescu@intel.com > CC: jasvinder.singh@intel.com > > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> The 4 patches in this series have the same title, same explanation and same root cause. Only the coverity ID is changing. In this case, you can merge all patches together and reference all coverity ids on the same line with commas. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] net/softnic: fix string copy 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan ` (3 preceding siblings ...) 2018-10-31 9:47 ` [dpdk-dev] [PATCH 1/4] " Thomas Monjalon @ 2018-10-31 10:16 ` Reshma Pattan 2018-11-02 11:47 ` Dumitrescu, Cristian 4 siblings, 1 reply; 7+ messages in thread From: Reshma Pattan @ 2018-10-31 10:16 UTC (permalink / raw) To: dev; +Cc: cristian.dumitrescu, jasvinder.singh, Reshma Pattan Use strlcpy instead of strcpy to avoid buffer overrun. Coverity issues: 323475,323478,323514,323515 Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") Fixes: c169b6a588 ("net/softnic: map flow attribute to pipeline table") CC: cristian.dumitrescu@intel.com CC: jasvinder.singh@intel.com Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> --- v2: merge the below patches into single patch. http://patchwork.dpdk.org/patch/47570/ http://patchwork.dpdk.org/patch/47571/ http://patchwork.dpdk.org/patch/47572/ http://patchwork.dpdk.org/patch/47573/ --- drivers/net/softnic/rte_eth_softnic_cli.c | 22 ++++++++++++---------- drivers/net/softnic/rte_eth_softnic_flow.c | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index c6640d658..57b623377 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -1867,7 +1867,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_RXQ; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); if (strcmp(tokens[t0 + 2], "rxq") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rxq"); @@ -1890,7 +1890,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_SWQ; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); t0 += 2; } else if (strcmp(tokens[t0], "tmgr") == 0) { @@ -1902,7 +1902,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_TMGR; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); t0 += 2; } else if (strcmp(tokens[t0], "tap") == 0) { @@ -1914,7 +1914,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, p.type = PORT_IN_TAP; - strcpy(p.dev_name, tokens[t0 + 1]); + strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); if (strcmp(tokens[t0 + 2], "mempool") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, @@ -2009,7 +2009,8 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, return; } - strcpy(p.action_profile_name, tokens[t0 + 1]); + strlcpy(p.action_profile_name, tokens[t0 + 1], + sizeof(p.action_profile_name)); t0 += 2; } @@ -2096,7 +2097,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TXQ; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); if (strcmp(tokens[8], "txq") != 0) { snprintf(out, out_size, MSG_ARG_NOT_FOUND, "txq"); @@ -2117,7 +2118,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_SWQ; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "tmgr") == 0) { if (n_tokens != 8) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -2127,7 +2128,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TMGR; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "tap") == 0) { if (n_tokens != 8) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -2137,7 +2138,7 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_TAP; - strcpy(p.dev_name, tokens[7]); + strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "sink") == 0) { if ((n_tokens != 7) && (n_tokens != 11)) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -2485,7 +2486,8 @@ cmd_pipeline_table(struct pmd_internals *softnic, return; } - strcpy(p.action_profile_name, tokens[t0 + 1]); + strlcpy(p.action_profile_name, tokens[t0 + 1], + sizeof(p.action_profile_name)); t0 += 2; } diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index 285af462b..295bc6c83 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -56,7 +56,7 @@ flow_attr_map_set(struct pmd_internals *softnic, map = (ingress) ? &softnic->flow.ingress_map[group_id] : &softnic->flow.egress_map[group_id]; - strcpy(map->pipeline_name, pipeline_name); + strlcpy(map->pipeline_name, pipeline_name, sizeof(map->pipeline_name)); map->table_id = table_id; map->valid = 1; -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/softnic: fix string copy 2018-10-31 10:16 ` [dpdk-dev] [PATCH v2] " Reshma Pattan @ 2018-11-02 11:47 ` Dumitrescu, Cristian 0 siblings, 0 replies; 7+ messages in thread From: Dumitrescu, Cristian @ 2018-11-02 11:47 UTC (permalink / raw) To: Pattan, Reshma, dev; +Cc: Singh, Jasvinder > -----Original Message----- > From: Pattan, Reshma > Sent: Wednesday, October 31, 2018 10:17 AM > To: dev@dpdk.org > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder > <jasvinder.singh@intel.com>; Pattan, Reshma <reshma.pattan@intel.com> > Subject: [PATCH v2] net/softnic: fix string copy > > Use strlcpy instead of strcpy to avoid buffer overrun. > > Coverity issues: 323475,323478,323514,323515 > > Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays") > Fixes: c169b6a588 ("net/softnic: map flow attribute to pipeline table") > CC: cristian.dumitrescu@intel.com > CC: jasvinder.singh@intel.com > > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> > --- > v2: merge the below patches into single patch. > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Applied to next-pipeline tree, thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-11-02 11:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] net/softnic: fix string copy Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 2/4] " Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 3/4] " Reshma Pattan 2018-10-30 14:22 ` [dpdk-dev] [PATCH 4/4] " Reshma Pattan 2018-10-31 9:47 ` [dpdk-dev] [PATCH 1/4] " Thomas Monjalon 2018-10-31 10:16 ` [dpdk-dev] [PATCH v2] " Reshma Pattan 2018-11-02 11:47 ` Dumitrescu, Cristian
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).