aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ux500
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/ux500')
-rw-r--r--drivers/crypto/ux500/hash/hash_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index 1827e9f1f873..cf5508967539 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -938,6 +938,7 @@ static int hash_dma_final(struct ahash_request *req)
938 if (!ctx->device->dma.nents) { 938 if (!ctx->device->dma.nents) {
939 dev_err(device_data->dev, "[%s] " 939 dev_err(device_data->dev, "[%s] "
940 "ctx->device->dma.nents = 0", __func__); 940 "ctx->device->dma.nents = 0", __func__);
941 ret = ctx->device->dma.nents;
941 goto out; 942 goto out;
942 } 943 }
943 944
@@ -945,6 +946,7 @@ static int hash_dma_final(struct ahash_request *req)
945 if (bytes_written != req->nbytes) { 946 if (bytes_written != req->nbytes) {
946 dev_err(device_data->dev, "[%s] " 947 dev_err(device_data->dev, "[%s] "
947 "hash_dma_write() failed!", __func__); 948 "hash_dma_write() failed!", __func__);
949 ret = bytes_written;
948 goto out; 950 goto out;
949 } 951 }
950 952
@@ -1367,14 +1369,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
1367 /** 1369 /**
1368 * Freed in final. 1370 * Freed in final.
1369 */ 1371 */
1370 ctx->key = kmalloc(keylen, GFP_KERNEL); 1372 ctx->key = kmemdup(key, keylen, GFP_KERNEL);
1371 if (!ctx->key) { 1373 if (!ctx->key) {
1372 pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key " 1374 pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
1373 "for %d\n", __func__, alg); 1375 "for %d\n", __func__, alg);
1374 return -ENOMEM; 1376 return -ENOMEM;
1375 } 1377 }
1376
1377 memcpy(ctx->key, key, keylen);
1378 ctx->keylen = keylen; 1378 ctx->keylen = keylen;
1379 1379
1380 return ret; 1380 return ret;