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: <284c0843-b749-00c8-95bc-6a0b220d9421@nfschina.com>
Date: Wed, 12 Jul 2023 09:44:40 +0800
From: yunchuan <yunchuan@...china.com>
To: Simon Horman <simon.horman@...igine.com>
Cc: mostrows@...thlink.net, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com, xeb@...l.ru, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next v2 03/10] net: ppp: Remove unnecessary (void*)
 conversions

On 2023/7/12 01:50, Simon Horman wrote:
>> -	struct sock *sk = (struct sock *)chan->private;
>> +	struct sock *sk = chan->private;
>>   	struct pppox_sock *po = pppox_sk(sk);
>>   	struct net_device *dev = po->pppoe_dev;
> Hi,
>
> Please don't break reverse xmas tree ordering - longest line to shortest -
> of local variable declarations in Networking code.

Hi,

This can't be reversed because it depends on the first declaration.
Should I change it like this?

-	struct sock *sk = (struct sock *)chan->private;
- 	struct pppox_sock *po = pppox_sk(sk);
+	struct pppox_sock *po = pppox_sk(chan->private);
  	struct net_device *dev = po->pppoe_dev;
+	struct sock *sk = chan->private;

But this seems to be bad. As the advice of Andrew[1] and Dan[2]:

"

When dealing with existing broken reverse Christmas tree, please don't
make it worse with a change. But actually fixing it should be in a
different patch.

We want patches to be obviously correct. By removing the cast and
moving variables around, it is less obvious it is correct, than having
two patches.

"

Wu Yunchuan

[1] 
https://lore.kernel.org/all/23e98085-8f07-4ee2-8487-8e3b439b69f4@lunn.ch/
[2] 
https://lore.kernel.org/all/45519aec-6ec8-49e5-b5b2-1b52d336288c@kadam.mountain/
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ