Skip to contentSkip to conversation

net/nfp: check value returned

PATCH Applied Alejandro Lucero 2 participants 2 messages Apr 8, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/nfp: check value returned

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")
---
 drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/nfp/nfpcore/nfp-common/nfp_cppat.h +3 -0
index 6e380cca0..538f882bf 100644
@@ -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
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 8 lines · Alejandro Lucero

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")

Applied to dpdk-next-net/master, thanks.

(squashed with other return value check patches, since all are fixing same commit there wouldn't be any backport concern)