Skip to content

Commit

Permalink
ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
Browse files Browse the repository at this point in the history
Issue identified with Coccinelle.

Signed-off-by: YueHaibing <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
YueHaibing authored and davem330 committed May 24, 2021
1 parent 5d6c3d9 commit ec7d6dd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/freescale/ucc_geth.c
Original file line number Diff line number Diff line change
Expand Up @@ -3590,10 +3590,9 @@ static int ucc_geth_probe(struct platform_device* ofdev)
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;

ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL);
if (ug_info == NULL)
return -ENOMEM;
memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));

ug_info->uf_info.ucc_num = ucc_num;

Expand Down

0 comments on commit ec7d6dd

Please sign in to comment.