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] [day] [month] [year] [list]
Message-ID: <337f8acc-63d0-4a0b-f112-0e7be1a7e51f@solarflare.com>
Date:   Wed, 30 Oct 2019 19:12:37 +0000
From:   Edward Cree <ecree@...arflare.com>
To:     zhong jiang <zhongjiang@...wei.com>, <davem@...emloft.net>
CC:     <mhabets@...arflare.com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sfc: should check the return value after allocating
 memory

On 30/10/2019 09:12, zhong jiang wrote:
> kcalloc may fails to allocate memory, hence if it is in that case,
> We should drop out in time.
> 
> Signed-off-by: zhong jiang <zhongjiang@...wei.com>
> ---
>  drivers/net/ethernet/sfc/efx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
> index 2fef740..712380a 100644
> --- a/drivers/net/ethernet/sfc/efx.c
> +++ b/drivers/net/ethernet/sfc/efx.c
> @@ -3040,6 +3040,8 @@ static int efx_init_struct(struct efx_nic *efx,
>  	/* Failure to allocate is not fatal, but may degrade ARFS performance */
>  	efx->rps_hash_table = kcalloc(EFX_ARFS_HASH_TABLE_SIZE,
>  				      sizeof(*efx->rps_hash_table), GFP_KERNEL);
> +	if (!efx->rps_hash_table)
> +		goto fail;
NAK.
As per the comment just above the allocation, if this allocation fails we are
 able to continue (albeit with possibly reduced performance), since the code
 paths that use efx->rps_hash_table all NULL-check it.

-Ed
>  #endif
>  	efx->phy_op = &efx_dummy_phy_operations;
>  	efx->mdio.dev = net_dev;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ