Commit aa8b6dd4 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Herbert Xu
Browse files

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: default avatarTudor Ambarus <tudor-dan.ambarus@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0c4935b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);