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: <20170817.102108.1936054141019427795.davem@davemloft.net>
Date:   Thu, 17 Aug 2017 10:21:08 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     David.Laight@...LAB.COM
Cc:     saeedm@...lanox.com, netdev@...r.kernel.org, leonro@...lanox.com,
        ogerlitz@...lanox.com
Subject: Re: [net-next 11/15] net/mlx5e: Properly indent within conditional
 statements

From: David Laight <David.Laight@...LAB.COM>
Date: Thu, 17 Aug 2017 14:18:29 +0000

> From: Saeed Mahameed
>> Sent: 17 August 2017 14:30
>> To: David S. Miller
>> Cc: netdev@...r.kernel.org; Leon Romanovsky; Or Gerlitz; Saeed Mahameed
>> Subject: [net-next 11/15] net/mlx5e: Properly indent within conditional statements
>> 
>> From: Or Gerlitz <ogerlitz@...lanox.com>
>> 
>> To fix these checkpatch complaints:
>> 
>> WARNING: suspect code indent for conditional statements (8, 24)
>> +       if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
>> [...]
>> +                       return PORT_FIBRE;
>> 
>> Signed-off-by: Or Gerlitz <ogerlitz@...lanox.com>
>> Signed-off-by: Saeed Mahameed <saeedm@...lanox.com>
>> ---
>>  .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 22 +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>> 
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> index a75ac4d11c5b..ed161312a773 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>> @@ -988,23 +988,23 @@ static u8 get_connector_port(u32 eth_proto, u8 connector_type)
>>  		return ptys2connector_type[connector_type];
>> 
>>  	if (eth_proto & (MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
>> -			 | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
>> -			 | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
>> -			 | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
>> -			return PORT_FIBRE;
>> +	    | MLX5E_PROT_MASK(MLX5E_40GBASE_SR4)
>> +	    | MLX5E_PROT_MASK(MLX5E_100GBASE_SR4)
>> +	    | MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII))) {
>> +		return PORT_FIBRE;
> 
> Gah, that is why the rules are stupid.
> If anything the continuation lines want indenting a few more bytes.

And in fact, operators should be at the end rather the beginning of lines.
This statement therefore must be formatted like this:

	if (x & (A |
		 B |
		 C |
		 C))

The indentation shows the grouping, therefore each line after the first must
start exactly at the column after the inner openning parenthesis.

Please fix this properly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ