From: YueHaibing Date: Mon, 21 Jan 2019 07:57:00 +0000 (+0000) Subject: crypto: seqiv - Use kmemdup in seqiv_aead_encrypt() X-Git-Tag: microblaze-v5.4-rc1~1136^2~95 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=7e33d4d48974e06745514a68c8b1670e5006a4dd;p=linux-2.6-microblaze.git crypto: seqiv - Use kmemdup in seqiv_aead_encrypt() Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing Signed-off-by: Herbert Xu --- diff --git a/crypto/seqiv.c b/crypto/seqiv.c index 64a412be255e..ed1b0e9f2436 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; }