From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, fiona.trahe@intel.com,
roy.fan.zhang@intel.com,
Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [dpdk-dev] [PATCH] crypto/qat: fix illegal access of an array
Date: Mon, 26 Jul 2021 17:47:49 +0100 [thread overview]
Message-ID: <20210726164749.10878-1-arkadiuszx.kusztal@intel.com> (raw)
Fix possible access of an array by negative index in function
qat_sym_qp_setup.
Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")
Coverity issue: 372131
Coverity issue: 372134
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
drivers/crypto/qat/qat_sym_pmd.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index 1c7b142511..6868e5f001 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -176,16 +176,17 @@ static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
int ring_pair =
qat_select_valid_queue(qat_dev, qp_id,
QAT_SERVICE_SYMMETRIC);
- sym_hw_qps =
- &qat_dev->qp_gen4_data[0][0];
- qp_hw_data =
- &qat_dev->qp_gen4_data[ring_pair][0];
+
if (ring_pair < 0) {
QAT_LOG(ERR,
"qp_id %u invalid for this device, no enough services allocated for GEN4 device",
qp_id);
return -EINVAL;
}
+ sym_hw_qps =
+ &qat_dev->qp_gen4_data[0][0];
+ qp_hw_data =
+ &qat_dev->qp_gen4_data[ring_pair][0];
} else {
sym_hw_qps = qat_gen_config[qat_dev->qat_dev_gen]
.qp_hw_data[QAT_SERVICE_SYMMETRIC];
--
2.30.2
next reply other threads:[~2021-07-26 16:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 16:47 Arek Kusztal [this message]
2021-07-27 9:31 ` Dybkowski, AdamX
2021-07-27 17:36 ` Akhil Goyal
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=20210726164749.10878-1-arkadiuszx.kusztal@intel.com \
--to=arkadiuszx.kusztal@intel.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=gakhil@marvell.com \
--cc=roy.fan.zhang@intel.com \
/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).