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  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]
Date:   Thu, 23 Feb 2017 09:50:16 +0000
From:   Paul Crawford <psc@....dundee.ac.uk>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...e.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Brian Gerst <brgerst@...il.com>,
        Chris Metcalf <cmetcalf@...lanox.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Liang Z Li <liang.z.li@...el.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Huang Rui <ray.huang@....com>, Jiri Slaby <jslaby@...e.cz>,
        Jonathan Corbet <corbet@....net>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Paul Gortmaker <paul.gortmaker@...driver.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Chen Yucong <slaoub@...il.com>,
        Alexandre Julliard <julliard@...ehq.org>,
        Stas Sergeev <stsp@...t.ru>, Fenghua Yu <fenghua.yu@...el.com>,
        "Ravi V. Shankar" <ravi.v.shankar@...el.com>,
        Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
        x86@...nel.org, linux-msdos@...r.kernel.org, wine-devel@...ehq.org,
        Adam Buchbinder <adam.buchbinder@...il.com>,
        Colin Ian King <colin.king@...onical.com>,
        Lorenzo Stoakes <lstoakes@...il.com>,
        Qiaowei Ren <qiaowei.ren@...el.com>
Subject: Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to
 R/ESP

On 23/02/17 07:24, Peter Zijlstra wrote:
> On Wed, Feb 22, 2017 at 10:36:50PM -0800, Ricardo Neri wrote:
>> +			/*
>> +			 * A negative offset generally means a error, except
>> +			 * -EDOM, which means that the contents of the register
>> +			 * should not be used as index.
>> +			 */
>>  			if (indx_offset < 0)
>> -				goto out_err;
>> +				if (indx_offset == -EDOM)
>> +					indx = 0;
>> +				else
>> +					goto out_err;
>> +			else
>> +				indx = regs_get_register(regs, indx_offset);
>
> Kernel coding style requires more brackets than are strictly required by
> C, any block longer than 1 line needs then. Also, if one leg of a
> conditional needs them, then they should be on both legs.
>
> Your code has many such instances, please change them all.

This was one issue raised with the OpenSSL review where a lack of 
brackets made some coding errors less obvious and in the changes was 
down as applying "KNF format the whole source tree"

Probably the easiest fix is to use some tool like "indent --linux-style" 
though I am not completely sure that option is perfect.

Certainly if you have code with an odd mix of styles it is much harder 
to read, and ultimately source code is for *humans* to understand. So 
enforcing a consistent style, even if it is not your own style, makes it 
much easier to follow!

Just my 2p worth.

Regard,
Paul
-- 
  Dr. Paul S. Crawford
  c/o Satellite Station
  University of Dundee
  Small's Wynd, Dundee, DD1 4HN
  Email: psc@....dundee.ac.uk
  Tel: +44 (0)1382 38 4687
  The University of Dundee is a Scottish Registered Charity, No. SC015096

Powered by blists - more mailing lists