summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorTudor Ambarus <tudor-dan.ambarus@nxp.com>2016-03-23 16:06:39 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-04-05 14:35:52 +0200
commitaa8b6dd4b06bab62ec7f8972f9e66782dbc23d60 (patch)
treec557e3efb51b72b0ec3ef7b4e09b1803ca303fdd /drivers/crypto/qat
parentcrypto: qat - Remove redundant nrbg rings (diff)
downloadlinux-aa8b6dd4b06bab62ec7f8972f9e66782dbc23d60.tar.xz
linux-aa8b6dd4b06bab62ec7f8972f9e66782dbc23d60.zip
crypto: qat - avoid memory corruption or undefined behaviour
memcopying to a (null pointer + offset) will result in memory corruption or undefined behaviour. Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_common/qat_asym_algs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c
index e5c0727d4876..8dbbf0849436 100644
--- a/drivers/crypto/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c
@@ -593,7 +593,7 @@ int qat_rsa_get_d(void *context, size_t hdrlen, unsigned char tag,
ret = -ENOMEM;
ctx->d = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_d, GFP_KERNEL);
- if (!ctx->n)
+ if (!ctx->d)
goto err;
memcpy(ctx->d + (ctx->key_sz - vlen), ptr, vlen);