Adjust memory check and use in a proper order to avoid
null pointer dereference.

Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")

Signed-off-by: Weiguo Li <liw...@foxmail.com>
---
 drivers/crypto/ipsec_mb/ipsec_mb_private.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h 
b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 866722d6f4..cae8f68988 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -191,12 +191,11 @@ 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) {
-- 
2.25.1

Reply via email to