[PATCH 1/8] crypto/cnxk: check for null pointer
Tejasree Kondoj
ktejasree at marvell.com
Mon Jun 19 14:45:21 CEST 2023
Checking for NULL pointer dereference.
Signed-off-by: Tejasree Kondoj <ktejasree at marvell.com>
---
drivers/crypto/cnxk/cnxk_se.h | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index c66ab80749..a85e4c5170 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -2185,12 +2185,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)
if (zsk_flag && sess->roc_se_ctx.auth_then_ciph) {
struct rte_crypto_cipher_xform *c_form;
- c_form = &xform->next->cipher;
- if (c_form->op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
- a_form->op != RTE_CRYPTO_AUTH_OP_GENERATE) {
- plt_dp_err("Crypto: PDCP auth then cipher must use"
- " options: encrypt and generate");
- return -EINVAL;
+ if (xform->next != NULL) {
+ c_form = &xform->next->cipher;
+ if ((c_form != NULL) && (c_form->op != RTE_CRYPTO_CIPHER_OP_ENCRYPT) &&
+ a_form->op != RTE_CRYPTO_AUTH_OP_GENERATE) {
+ plt_dp_err("Crypto: PDCP auth then cipher must use"
+ " options: encrypt and generate");
+ return -EINVAL;
+ }
}
}
--
2.25.1
More information about the dev
mailing list