qat: fix null pointer dereferencing
authorDeepak Kumar Jain <deepak.k.jain@intel.com>
Wed, 18 May 2016 16:12:38 +0000 (17:12 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 7 Jun 2016 14:40:26 +0000 (16:40 +0200)
Fix null pointer dereferencing while clearing session

Coverity issue: 126586
Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
drivers/crypto/qat/qat_crypto.c

index 495ea1c..a084692 100644 (file)
@@ -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