From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A9825A058A; Fri, 17 Apr 2020 17:42:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1AC171E984; Fri, 17 Apr 2020 17:42:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4FEA61E97D for ; Fri, 17 Apr 2020 17:42:52 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03HFaFvl018167 for ; Fri, 17 Apr 2020 08:42:51 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=8aUBk2iRXAZNneETXW/gExYxkJULJS3l5osrUI9+0Wk=; b=ypEjLqSNCx2OoCpFWfXobOY+/OUoStGjEDMUOD+tMOjab7NnhYMLQJjBbJnDgkWhbW7v aeuhIdxMSgvPwotHqYs+c9lYFjVf3UuL30FhTuKDkz6sGaFWZ+3R5s/T/cJ1oUXNhtB5 WLj2IqcuiR8FF+7HIK1xGj9yCxo4vFim+PIjxq13Mucc9QykEu3SmyBKKvF9o9W7fjLq 8q3JcAMiYxRSwcu9xDFch68xo2kxtPt6VHHOyFkgv6f6lH+PA4Hj6D026oNRcQOPS3u5 jKeUMwwxhr01VE1Kt1wDfVjNAK291SiEbVEy1LHOXvH2Fi0o6EXZrSRLn9Cpj8l4RSqC tQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 30dn84vs2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 17 Apr 2020 08:42:51 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Apr 2020 08:42:49 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Apr 2020 08:42:49 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 17 Apr 2020 08:42:48 -0700 Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id BCE383F7043; Fri, 17 Apr 2020 08:42:46 -0700 (PDT) From: Ankur Dwivedi To: CC: , , Ankur Dwivedi Date: Fri, 17 Apr 2020 21:11:55 +0530 Message-ID: <1587138115-13149-2-git-send-email-adwivedi@marvell.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1587138115-13149-1-git-send-email-adwivedi@marvell.com> References: <1587138115-13149-1-git-send-email-adwivedi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-17_07:2020-04-17, 2020-04-17 signatures=0 Subject: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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