lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f30c31a7-68fa-bd89-1ddf-857808a33f15@prevas.dk>
Date:   Tue, 9 Mar 2021 22:41:47 +0100
From:   Rasmus Villemoes <rasmus.villemoes@...vas.dk>
To:     angkery <angkery@....com>, leoyang.li@....com, davem@...emloft.net,
        kuba@...nel.org
Cc:     netdev@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org, Junlin Yang <yangjunlin@...ong.com>
Subject: Re: [PATCH] ethernet: ucc_geth: Use kmemdup instead of kmalloc and
 memcpy

On 05/03/2021 15.27, angkery wrote:
> From: Junlin Yang <yangjunlin@...ong.com>
> 
> Fixes coccicheck warnings:
> ./drivers/net/ethernet/freescale/ucc_geth.c:3594:11-18:
> WARNING opportunity for kmemdup
> 
> Signed-off-by: Junlin Yang <yangjunlin@...ong.com>
> ---
>  drivers/net/ethernet/freescale/ucc_geth.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
> index ef4e2fe..2c079ad 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3591,10 +3591,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;
>  
> 

Ah, yes, of course, I should have used that.

Acked-by: Rasmus Villemoes <rasmus.villemoes@...vas.dk>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ