summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorJia-Ju Bai <baijiaju1990@gmail.com>2021-03-05 04:57:17 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2021-03-12 16:04:04 +0300
commit282894556b8349d3c095eedadc4dde9495d48445 (patch)
treeb8054acc9fa1aca76ba8369d594a56057613eae0 /drivers/crypto
parent90274769cf7926a7a14f1cd3f47b66de76e0adb4 (diff)
downloadlinux-282894556b8349d3c095eedadc4dde9495d48445.tar.xz
crypto: sun8i-ce - fix error return code in sun8i_ce_prng_generate()
When dma_mapping_error() returns an error, no error return code of sun8i_ce_prng_generate() is assigned. To fix this bug, err is assigned with -EFAULT as error return code. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
index cfde9ee4356b..cd1baee424a1 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
@@ -99,6 +99,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 *src,
dma_iv = dma_map_single(ce->dev, ctx->seed, ctx->slen, DMA_TO_DEVICE);
if (dma_mapping_error(ce->dev, dma_iv)) {
dev_err(ce->dev, "Cannot DMA MAP IV\n");
+ err = -EFAULT;
goto err_iv;
}