From: Fabio Estevam <fabio.estevam@xxxxxxx> Use kmemdup() rather than duplicating its implementation. Detected with Coccinelle script. Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxx> --- drivers/crypto/caam/caampkc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index 979072b..c3518ce 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -789,12 +789,10 @@ static inline u8 *caam_read_raw_data(const u8 *buf, size_t *nbytes) if (!*nbytes) return NULL; - val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL); + val = kmemdup(buf, *nbytes, GFP_DMA | GFP_KERNEL); if (!val) return NULL; - memcpy(val, buf, *nbytes); - return val; } -- 2.7.4