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: <dc0cf96a-bd1d-6e00-a074-98029c5d8e3b@huawei.com>
Date: Wed, 2 Aug 2023 10:27:47 +0800
From: Ruan Jinjie <ruanjinjie@...wei.com>
To: Simon Horman <horms@...nel.org>
CC: <tariqt@...dia.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <linux-rdma@...r.kernel.org>,
	<netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net/mlx4: remove many unnecessary NULL values



On 2023/8/1 23:40, Simon Horman wrote:
> On Tue, Aug 01, 2023 at 08:34:22PM +0800, Ruan Jinjie wrote:
>> Ther are many pointers assigned first, which need not to be initialized, so
>> remove the NULL assignment.
> 
> How about something like:
> 
> Don't initialise local variables to NULL which are always
> set to other values elsewhere in the same function.

I think these NULL assignments can also be removed.

> 
>> Signed-off-by: Ruan Jinjie <ruanjinjie@...wei.com>
> 
> ...
> 
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> 
> ...
> 
>> @@ -2294,8 +2294,8 @@ static int mlx4_init_fw(struct mlx4_dev *dev)
>>  static int mlx4_init_hca(struct mlx4_dev *dev)
>>  {
>>  	struct mlx4_priv	  *priv = mlx4_priv(dev);
>> -	struct mlx4_init_hca_param *init_hca = NULL;
>> -	struct mlx4_dev_cap	  *dev_cap = NULL;
>> +	struct mlx4_init_hca_param *init_hca;
>> +	struct mlx4_dev_cap	  *dev_cap;
>>  	struct mlx4_adapter	   adapter;
>>  	struct mlx4_profile	   profile;
>>  	u64 icm_size;
> 
> This last hunk doesn't seem correct, as it doesn't
> seem these aren't always initialised elsewhere in the function
> before being passed to kfree().

Yes, this kind of situation the NULL assignments should not be removed,I'll
reserch it more.

> 
>> -- 
>> 2.34.1
>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ