crypto: ccp - Use kmemdup in ccp_copy_and_save_keypart()
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
61abc356bf
commit
8316da02e3
@ -37,10 +37,9 @@ static inline int ccp_copy_and_save_keypart(u8 **kpbuf, unsigned int *kplen,
|
|||||||
if (buf[nskip])
|
if (buf[nskip])
|
||||||
break;
|
break;
|
||||||
*kplen = sz - nskip;
|
*kplen = sz - nskip;
|
||||||
*kpbuf = kzalloc(*kplen, GFP_KERNEL);
|
*kpbuf = kmemdup(buf + nskip, *kplen, GFP_KERNEL);
|
||||||
if (!*kpbuf)
|
if (!*kpbuf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(*kpbuf, buf + nskip, *kplen);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user