[2/2] net/nfp: fix illegal memory accesses

Message ID 20231010061727.205886-3-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Fix two converity issue of NFP PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Chaoyong He Oct. 10, 2023, 6:17 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

CI found that overrunning array of 8 bytes at byte
offset 8 by dereferencing pointer.

Coverity issue: 403098
Fixes: 9641a2d ("net/nfp: refactor rtsym module")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_rtsym.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 022753f98a..5cefbace96 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -337,7 +337,7 @@  nfp_rtsym_read_real(struct nfp_cpp *cpp,
 	size_t length = len;
 	uint64_t sym_size = nfp_rtsym_size(sym);
 
-	if (offset > sym_size) {
+	if (offset >= sym_size) {
 		PMD_DRV_LOG(ERR, "rtsym '%s' read out of bounds", sym->name);
 		return -ENXIO;
 	}