net/softnic: fix resource leak for pipeline

For sending request messages to data plane threads, the
caller invokes pipeline_msg_send_recv() function which never
returns null response. Thus, removed redundant check on
the returned response.

Coverity issue: 357676, 357680, 357681, 357682, 357690, 357693, 357711
Coverity issue: 357722, 357725, 357734, 357739, 357743, 357747, 357762
Coverity issue: 357766, 357787

Fixes: 6d4d054025 ("net/softnic: add command to read stats")
Fixes: 202905f3ee ("net/softnic: add command to create objects")
Fixes: ee19326a4b ("net/softnic: add command for pipeline table entries")
Fixes: 9bc0ce0ad1 ("net/softnic: add command for meter action")
Fixes: 2505030a83 ("net/softnic: add command for TTL action")
Cc: stable@dpdk.org

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
This commit is contained in:
Jasvinder Singh 2020-04-27 18:15:51 +01:00 committed by Ferruh Yigit
parent 22335d4348
commit c1ea7a5f99

View File

@ -835,8 +835,6 @@ softnic_pipeline_port_in_stats_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -884,8 +882,6 @@ softnic_pipeline_port_in_enable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -931,8 +927,6 @@ softnic_pipeline_port_in_disable(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -986,8 +980,6 @@ softnic_pipeline_port_out_stats_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1043,8 +1035,6 @@ softnic_pipeline_table_stats_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1323,8 +1313,6 @@ softnic_pipeline_table_rule_add(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1407,8 +1395,6 @@ softnic_pipeline_table_rule_add_default(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1565,8 +1551,6 @@ softnic_pipeline_table_rule_add_bulk(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1630,8 +1614,6 @@ softnic_pipeline_table_rule_delete(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1680,8 +1662,6 @@ softnic_pipeline_table_rule_delete_default(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1740,8 +1720,6 @@ softnic_pipeline_table_rule_stats_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1821,10 +1799,6 @@ softnic_pipeline_table_mtr_profile_add(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL) {
free(mp);
return -1;
}
/* Read response */
status = rsp->status;
@ -1880,8 +1854,6 @@ softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -1943,8 +1915,6 @@ softnic_pipeline_table_rule_mtr_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -2008,8 +1978,6 @@ softnic_pipeline_table_dscp_table_update(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;
@ -2073,8 +2041,6 @@ softnic_pipeline_table_rule_ttl_read(struct pmd_internals *softnic,
/* Send request and wait for response */
rsp = pipeline_msg_send_recv(p, req);
if (rsp == NULL)
return -1;
/* Read response */
status = rsp->status;