From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <lbartosik@marvell.com>, <anoobj@marvell.com>,
Ankur Dwivedi <adwivedi@marvell.com>
Subject: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function
Date: Fri, 17 Apr 2020 21:11:55 +0530 [thread overview]
Message-ID: <1587138115-13149-2-git-send-email-adwivedi@marvell.com> (raw)
In-Reply-To: <1587138115-13149-1-git-send-email-adwivedi@marvell.com>
The return values of functions are checked before proceeding further.
Coverity Issues: 355670, 355671, 355672, 355673
Fixes: ec3cc53f5a66 ("examples/ipsec-secgw: support internal ports for events"
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
examples/ipsec-secgw/event_helper.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
index 076f1f2..865dc91 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -100,12 +100,15 @@
eh_dev_has_rx_internal_port(uint8_t eventdev_id)
{
bool flag = true;
- int j;
+ int j, ret;
RTE_ETH_FOREACH_DEV(j) {
uint32_t caps = 0;
- rte_event_eth_rx_adapter_caps_get(eventdev_id, j, &caps);
+ ret = rte_event_eth_rx_adapter_caps_get(eventdev_id, j, &caps);
+ if (ret < 0)
+ return false;
+
if (!(caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT))
flag = false;
}
@@ -116,12 +119,15 @@
eh_dev_has_tx_internal_port(uint8_t eventdev_id)
{
bool flag = true;
- int j;
+ int j, ret;
RTE_ETH_FOREACH_DEV(j) {
uint32_t caps = 0;
- rte_event_eth_tx_adapter_caps_get(eventdev_id, j, &caps);
+ ret = rte_event_eth_tx_adapter_caps_get(eventdev_id, j, &caps);
+ if (ret < 0)
+ return false;
+
if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
flag = false;
}
@@ -323,6 +329,7 @@
int nb_eth_dev;
int adapter_id;
int conn_id;
+ int ret;
int i;
/* Create one adapter with eth queues mapped to event queue(s) */
@@ -385,7 +392,12 @@
conn->ethdev_rx_qid = -1;
/* Get Rx adapter capabilities */
- rte_event_eth_rx_adapter_caps_get(eventdev_id, i, &caps);
+ ret = rte_event_eth_rx_adapter_caps_get(eventdev_id, i, &caps);
+ if (ret < 0) {
+ EH_LOG_ERR("Failed to get event device %d eth rx adapter"
+ " capabilities for port %d", eventdev_id, i);
+ return ret;
+ }
if (!(caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT))
rx_internal_port = false;
@@ -420,6 +432,7 @@
int adapter_id;
int nb_eth_dev;
int conn_id;
+ int ret;
int i;
/*
@@ -479,7 +492,12 @@
conn->ethdev_tx_qid = -1;
/* Get Tx adapter capabilities */
- rte_event_eth_tx_adapter_caps_get(eventdev_id, i, &caps);
+ ret = rte_event_eth_tx_adapter_caps_get(eventdev_id, i, &caps);
+ if (ret < 0) {
+ EH_LOG_ERR("Failed to get event device %d eth tx adapter"
+ " capabilities for port %d", eventdev_id, i);
+ return ret;
+ }
if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
tx_internal_port = false;
--
1.9.3
next prev parent reply other threads:[~2020-04-17 15:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 15:41 [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Ankur Dwivedi
2020-04-17 15:41 ` Ankur Dwivedi [this message]
2020-04-17 16:05 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function Anoob Joseph
2020-04-17 16:03 ` [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Anoob Joseph
2020-04-17 21:16 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1587138115-13149-2-git-send-email-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=lbartosik@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).