From 61d124fd4607058294a0fe617759428afdedb909 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Jain Date: Wed, 18 May 2016 17:12:38 +0100 Subject: [PATCH] qat: fix null pointer dereferencing Fix null pointer dereferencing while clearing session Coverity issue: 126586 Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices") Signed-off-by: Deepak Kumar Jain --- drivers/crypto/qat/qat_crypto.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 495ea1c766..a0846926be 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -276,14 +276,15 @@ void qat_crypto_sym_clear_session(struct rte_cryptodev *dev, void *session) { struct qat_session *sess = session; - phys_addr_t cd_paddr = sess->cd_paddr; + phys_addr_t cd_paddr; PMD_INIT_FUNC_TRACE(); if (session) { + cd_paddr = sess->cd_paddr; memset(sess, 0, qat_crypto_sym_get_session_private_size(dev)); - sess->cd_paddr = cd_paddr; - } + } else + PMD_DRV_LOG(ERR, "NULL session"); } static int -- 2.20.1