Skip to content

Commit ec7d6dd

Browse files
YueHaibingdavem330
authored andcommitted
ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
Issue identified with Coccinelle. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5d6c3d9 commit ec7d6dd

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎drivers/net/ethernet/freescale/ucc_geth.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,10 +3590,9 @@ static int ucc_geth_probe(struct platform_device* ofdev)
35903590
if ((ucc_num < 0) || (ucc_num > 7))
35913591
return -ENODEV;
35923592

3593-
ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
3593+
ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL);
35943594
if (ug_info == NULL)
35953595
return -ENOMEM;
3596-
memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));
35973596

35983597
ug_info->uf_info.ucc_num = ucc_num;
35993598

0 commit comments

Comments
 (0)