crypto: qat - Prevent dma mapping zero length assoc data
authorTadeusz Struk <tadeusz.struk@intel.com>
Tue, 14 Oct 2014 01:24:26 +0000 (18:24 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Oct 2014 14:37:33 +0000 (22:37 +0800)
Do not attempt to dma map associated data if it is zero length.

Cc: stable@vger.kernel.org
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Tested-by: Nikolay Aleksandrov <nikolay@redhat.com>
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/qat_algs.c

index f2e2f158cfbecec1bbef49a5b061d824c2365b3e..699ccf44e9bb96cbef5c1f3853c9cf70da1ff52d 100644 (file)
@@ -605,6 +605,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
                goto err;
 
        for_each_sg(assoc, sg, assoc_n, i) {
+               if (!sg->length)
+                       continue;
                bufl->bufers[bufs].addr = dma_map_single(dev,
                                                         sg_virt(sg),
                                                         sg->length,