From: Tadeusz Struk Date: Tue, 14 Oct 2014 01:24:26 +0000 (-0700) Subject: crypto: qat - Prevent dma mapping zero length assoc data X-Git-Tag: v4.14-rc1~6501^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=923a6e5e5f171317ac8bb462ac4b814fa7880d3c;p=platform%2Fkernel%2Flinux-rpi.git crypto: qat - Prevent dma mapping zero length assoc data Do not attempt to dma map associated data if it is zero length. Cc: stable@vger.kernel.org Signed-off-by: Tadeusz Struk Tested-by: Nikolay Aleksandrov Reviewed-by: Prarit Bhargava Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index f2e2f15..699ccf4 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -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,