Skip to content

Commit

Permalink
crypto: seqiv - Use kmemdup in seqiv_aead_encrypt()
Browse files Browse the repository at this point in the history
Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
YueHaibing authored and herbertx committed Feb 1, 2019
1 parent 231baec commit 7e33d4d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crypto/seqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7e33d4d

Please sign in to comment.