* [dpdk-dev] [PATCH] net/softnic: fix memory leak
@ 2020-04-27 14:05 Jasvinder Singh
2020-04-27 17:13 ` [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread Jasvinder Singh
0 siblings, 1 reply; 3+ messages in thread
From: Jasvinder Singh @ 2020-04-27 14:05 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu
When sending request messages to data plane thread, the
caller must free the memory allocated to request message
on receiving error response.
Coverity Issue: 357717, 357772
Fixes: 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
drivers/net/softnic/rte_eth_softnic_thread.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c
index d610b1617..028911c19 100644
--- a/drivers/net/softnic/rte_eth_softnic_thread.c
+++ b/drivers/net/softnic/rte_eth_softnic_thread.c
@@ -255,9 +255,9 @@ thread_msg_alloc(void)
}
static void
-thread_msg_free(struct thread_msg_rsp *rsp)
+thread_msg_free(void *msg)
{
- free(rsp);
+ free(msg);
}
static struct thread_msg_rsp *
@@ -359,8 +359,10 @@ softnic_thread_pipeline_enable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
+ if (rsp == NULL) {
+ thread_msg_free(req);
return -1;
+ }
/* Read response */
status = rsp->status;
@@ -444,8 +446,10 @@ softnic_thread_pipeline_disable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
+ if (rsp == NULL) {
+ thread_msg_free(req);
return -1;
+ }
/* Read response */
status = rsp->status;
--
2.21.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread
2020-04-27 14:05 [dpdk-dev] [PATCH] net/softnic: fix memory leak Jasvinder Singh
@ 2020-04-27 17:13 ` Jasvinder Singh
2020-05-01 15:47 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Jasvinder Singh @ 2020-04-27 17:13 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu
For sending request messages to data plane threads, the
caller invokes thread_msg_send_recv() function which never
returns null response. Thus, removed redundant check on
the returned response.
Coverity Issue: 357717, 357772
Fixes: 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v2:
- change commit message
drivers/net/softnic/rte_eth_softnic_thread.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c
index d610b1617..d61846e03 100644
--- a/drivers/net/softnic/rte_eth_softnic_thread.c
+++ b/drivers/net/softnic/rte_eth_softnic_thread.c
@@ -359,8 +359,6 @@ softnic_thread_pipeline_enable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
@@ -444,8 +442,6 @@ softnic_thread_pipeline_disable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = thread_msg_send_recv(softnic, thread_id, req);
- if (rsp == NULL)
- return -1;
/* Read response */
status = rsp->status;
--
2.21.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread
2020-04-27 17:13 ` [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread Jasvinder Singh
@ 2020-05-01 15:47 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-05-01 15:47 UTC (permalink / raw)
To: Jasvinder Singh, dev; +Cc: cristian.dumitrescu
On 4/27/2020 6:13 PM, Jasvinder Singh wrote:
> For sending request messages to data plane threads, the
> caller invokes thread_msg_send_recv() function which never
> returns null response. Thus, removed redundant check on
> the returned response.
>
> Coverity Issue: 357717, 357772
> Fixes: 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
>
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-01 15:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 14:05 [dpdk-dev] [PATCH] net/softnic: fix memory leak Jasvinder Singh
2020-04-27 17:13 ` [dpdk-dev] [PATCH v2] net/softnic: fix memory leak for thread Jasvinder Singh
2020-05-01 15:47 ` 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).