summaryrefslogtreecommitdiff
path: root/crypto/seqiv.c
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-01-21 07:57:00 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-01 14:42:03 +0800
commitbc1538f61cef87d75bd8212eeb16f4cad0163474 (patch)
tree08db30842fbfae306fba5d3ac89687d2bb036483 /crypto/seqiv.c
parent6f100b73adb230b1391a267a29bfef5bfaabceb1 (diff)
downloadlinux-crypto-bc1538f61cef87d75bd8212eeb16f4cad0163474.tar.gz
linux-crypto-bc1538f61cef87d75bd8212eeb16f4cad0163474.zip
crypto: seqiv - Use kmemdup in seqiv_aead_encrypt()
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/seqiv.c')
-rw-r--r--crypto/seqiv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/seqiv.c b/crypto/seqiv.c
index 64a412be..ed1b0e9f 100644
--- a/crypto/seqiv.c
+++ b/crypto/seqiv.c
@@ -89,13 +89,12 @@ static int seqiv_aead_encrypt(struct aead_request *req)
if (unlikely(!IS_ALIGNED((unsigned long)info,
crypto_aead_alignmask(geniv) + 1))) {
- info = kmalloc(ivsize, req->base.flags &
- CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL:
- GFP_ATOMIC);
+ info = kmemdup(req->iv, ivsize, req->base.flags &
+ CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
+ GFP_ATOMIC);
if (!info)
return -ENOMEM;
- memcpy(info, req->iv, ivsize);
compl = seqiv_aead_encrypt_complete;
data = req;
}