qat: fix crash when nothing to enqueue
authorFiona Trahe <fiona.trahe@intel.com>
Tue, 29 Mar 2016 17:10:20 +0000 (18:10 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 31 Mar 2016 19:49:26 +0000 (21:49 +0200)
Crash seen in qat pmd when nb_ops=0 on rte_cryptodev_enqueue_burst() API

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
drivers/crypto/qat/qat_crypto.c

index 5c41a89..9001558 100644 (file)
@@ -570,6 +570,9 @@ qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
        register uint32_t tail;
        int overflow;
 
+       if (unlikely(nb_ops == 0))
+               return 0;
+
        /* read params used a lot in main loop into registers */
        queue = &(tmp_qp->tx_q);
        base_addr = (uint8_t *)queue->base_addr;