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:
Родитель
61abc356bf
Коммит
8316da02e3
|
@ -37,10 +37,9 @@ static inline int ccp_copy_and_save_keypart(u8 **kpbuf, unsigned int *kplen,
|
|||
if (buf[nskip])
|
||||
break;
|
||||
*kplen = sz - nskip;
|
||||
*kpbuf = kzalloc(*kplen, GFP_KERNEL);
|
||||
*kpbuf = kmemdup(buf + nskip, *kplen, GFP_KERNEL);
|
||||
if (!*kpbuf)
|
||||
return -ENOMEM;
|
||||
memcpy(*kpbuf, buf + nskip, *kplen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче