From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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: , X-List-Received-Date: Mon, 08 Apr 2019 10:10:08 -0000 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 -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9B94CA0096 for ; Mon, 8 Apr 2019 12:10:10 +0200 (CEST) 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190408101008.nx8xGgyQ7urD6DXndHfZxci5fI-qG1gLNXXGVb9E-bs@z> 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 -- 2.17.1