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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250326103111.GC892515@horms.kernel.org>
Date: Wed, 26 Mar 2025 10:31:11 +0000
From: Simon Horman <horms@...nel.org>
To: Xin Tian <tianx@...silicon.com>
Cc: netdev@...r.kernel.org, leon@...nel.org, andrew+netdev@...n.ch,
	kuba@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
	davem@...emloft.net, jeff.johnson@....qualcomm.com,
	przemyslaw.kitszel@...el.com, weihg@...silicon.com,
	wanry@...silicon.com, jacky@...silicon.com,
	parthiban.veerasooran@...rochip.com, masahiroy@...nel.org,
	kalesh-anakkur.purayil@...adcom.com, geert+renesas@...der.be,
	geert@...ux-m68k.org
Subject: Re: [PATCH net-next v9 14/14] xsc: add ndo_get_stats64

On Tue, Mar 18, 2025 at 11:15:24PM +0800, Xin Tian wrote:

...

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/net/ethernet/yunsilicon/xsc/net/main.c

...

> @@ -1912,14 +1931,20 @@ static int xsc_eth_probe(struct auxiliary_device *adev,
>  		goto err_nic_cleanup;
>  	}
>  
> +	adapter->stats = kvzalloc(sizeof(*adapter->stats), GFP_KERNEL);
> +	if (!adapter->stats)

Hi Xin Tian,

I think you need to set err to -ENOMEM here, else the function will return 0
even though a memory allocation error has occurred.

Flagged by Smatch (please consider running this tool on your patches).

> +		goto err_detach;
> +
>  	err = register_netdev(netdev);
>  	if (err) {
>  		netdev_err(netdev, "register_netdev failed, err=%d\n", err);
> -		goto err_detach;
> +		goto err_free_stats;
>  	}
>  
>  	return 0;
>  
> +err_free_stats:
> +	kvfree(adapter->stats);
>  err_detach:
>  	xsc_eth_detach(xdev, adapter);
>  err_nic_cleanup:

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ