From patchwork Mon Apr 8 10:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Lucero X-Patchwork-Id: 52394 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B8932C24; Mon, 8 Apr 2019 12:10:09 +0200 (CEST) Received: from netronome.com (unknown [217.38.71.146]) by dpdk.org (Postfix) with ESMTP id 5C2262BD8; Mon, 8 Apr 2019 12:10:08 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id x38AA8NP007752; Mon, 8 Apr 2019 11:10:08 +0100 Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id x38AA8PC007751; Mon, 8 Apr 2019 11:10:08 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 8 Apr 2019 11:10:08 +0100 Message-Id: <20190408101008.7706-1-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/nfp: check value returned 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" If the call to _nfp6000_cppat_mu_locality fails, the function needs to return with an error. Coverity issue: 277215 Fixes: c7e9729da6b5 ("net/nfp: support CPP") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h b/drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h index 6e380cca0..538f882bf 100644 --- a/drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h +++ b/drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h @@ -368,6 +368,9 @@ _nfp6000_encode_mu(uint64_t *addr, int dest_island, int mode, int addr40, isld[1] = isld1; locality_lsb = _nfp6000_cppat_mu_locality_lsb(mode, addr40); + if (locality_lsb < 0) + return NFP_ERRNO(EINVAL); + if (((*addr >> locality_lsb) & 3) == _NIC_NFP6000_MU_LOCALITY_DIRECT) da = 1; else