DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alejandro Lucero <alejandro.lucero@netronome.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/nfp: check value returned
Date: Mon,  8 Apr 2019 11:10:08 +0100	[thread overview]
Message-ID: <20190408101008.7706-1-alejandro.lucero@netronome.com> (raw)
Message-ID: <20190408101008.nx8xGgyQ7urD6DXndHfZxci5fI-qG1gLNXXGVb9E-bs@z> (raw)

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 <alejandro.lucero@netronome.com>
---
 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


             reply	other threads:[~2019-04-08 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 10:10 Alejandro Lucero [this message]
2019-04-08 10:10 ` Alejandro Lucero
2019-04-08 16:31 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-04-08 16:31   ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2019-04-08  9:59 [dpdk-dev] " Alejandro Lucero
2019-04-08  9:59 ` Alejandro Lucero

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=20190408101008.7706-1-alejandro.lucero@netronome.com \
    --to=alejandro.lucero@netronome.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).