diff mbox series

[v2,net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy

Message ID 20210524010701.24596-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Commit ec7d6dd870d421a853ffa692d4bce5783a519342
Delegated to: Netdev Maintainers
Headers show
Series [v2,net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yue Haibing May 24, 2021, 1:07 a.m. UTC
Issue identified with Coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: keep kmemdup oneline

 drivers/net/ethernet/freescale/ucc_geth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andrew Lunn May 24, 2021, 1:20 a.m. UTC | #1
On Mon, May 24, 2021 at 09:07:01AM +0800, YueHaibing wrote:
> Issue identified with Coccinelle.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
patchwork-bot+netdevbpf@kernel.org May 24, 2021, 2 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 24 May 2021 09:07:01 +0800 you wrote:
> Issue identified with Coccinelle.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: keep kmemdup oneline
> 
>  drivers/net/ethernet/freescale/ucc_geth.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Here is the summary with links:
  - [v2,net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
    https://git.kernel.org/netdev/net-next/c/ec7d6dd870d4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index e0936510fa34..0acfafb73db1 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -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;