[1/6] common/octeontx2: fix out of bounds access

Message ID 1589621218-25339-2-git-send-email-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series improvements to OCTEON TX crypto PMDs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Anoob Joseph May 16, 2020, 9:26 a.m. UTC
  Coverity issue: 354230, 354231

Fixes: f44e71637755 ("net/octeontx2: add security session operations")
Fixes: 3fe4d07d1678 ("crypto/octeontx2: enable CPT to share QP with ethdev")

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/common/octeontx2/otx2_sec_idev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/common/octeontx2/otx2_sec_idev.c b/drivers/common/octeontx2/otx2_sec_idev.c
index 4e65ce2..6e9643c 100644
--- a/drivers/common/octeontx2/otx2_sec_idev.c
+++ b/drivers/common/octeontx2/otx2_sec_idev.c
@@ -55,7 +55,7 @@  otx2_sec_idev_tx_cpt_qp_add(uint16_t port_id, struct otx2_cpt_qp *qp)
 	struct otx2_sec_idev_cfg *cfg;
 	int i, ret;
 
-	if (qp == NULL || port_id > OTX2_MAX_INLINE_PORTS)
+	if (qp == NULL || port_id >= OTX2_MAX_INLINE_PORTS)
 		return -EINVAL;
 
 	cfg = &sec_cfg[port_id];
@@ -126,7 +126,7 @@  otx2_sec_idev_tx_cpt_qp_get(uint16_t port_id, struct otx2_cpt_qp **qp)
 	uint16_t index;
 	int i, ret;
 
-	if (port_id > OTX2_MAX_INLINE_PORTS || qp == NULL)
+	if (port_id >= OTX2_MAX_INLINE_PORTS || qp == NULL)
 		return -EINVAL;
 
 	cfg = &sec_cfg[port_id];