crypto/ipsec_mb: fix premature dereference

Message ID 20220116194043.1388372-1-piotrx.bronowski@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/ipsec_mb: fix premature dereference |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS

Commit Message

Piotr Bronowski Jan. 16, 2022, 7:40 p.m. UTC
  This patch removes coverity defect CID 374380:
Null pointer dereferences  (REVERSE_INULL)

Coverity issue: CID 374380
Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
---
 drivers/crypto/ipsec_mb/ipsec_mb_private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Akhil Goyal Feb. 8, 2022, 9:21 p.m. UTC | #1
> This patch removes coverity defect CID 374380:
> Null pointer dereferences  (REVERSE_INULL)
> 
> Coverity issue: CID 374380
> Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
> ---
Applied to dpdk-next-crypto
  

Patch

diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 866722d6f4..e53101acf1 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -191,13 +191,13 @@  ipsec_mb_parse_xform(const struct rte_crypto_sym_xform *xform,
 			const struct rte_crypto_sym_xform **cipher_xform,
 			const struct rte_crypto_sym_xform **aead_xform)
 {
-	const struct rte_crypto_sym_xform *next = xform->next;
-
 	if (xform == NULL) {
 		*mode = IPSEC_MB_OP_NOT_SUPPORTED;
 		return -ENOTSUP;
 	}
 
+	const struct rte_crypto_sym_xform *next = xform->next;
+
 	if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
 		if (next == NULL) {
 			if (xform->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {