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, 2 Nov 2017 12:07:13 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Ingo Molnar <mingo@...nel.org>
cc:     Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...e.de>,
        Peter Zijlstra <peterz@...radead.org>,
        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>,
        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>,
        "Ravi V. Shankar" <ravi.v.shankar@...el.com>,
        Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
        x86@...nel.org, ricardo.neri@...el.com,
        Adam Buchbinder <adam.buchbinder@...il.com>,
        Colin Ian King <colin.king@...onical.com>,
        Lorenzo Stoakes <lstoakes@...il.com>,
        Qiaowei Ren <qiaowei.ren@...el.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Kees Cook <keescook@...omium.org>,
        Thomas Garnier <thgarnie@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH v10 02/13] x86/insn-eval: Compute linear address in
 several utility functions

On Thu, 2 Nov 2017, Ingo Molnar wrote:
 
> * Ricardo Neri <ricardo.neri-calderon@...ux.intel.com> wrote:
> 
> > +	/*
> > +	 * -EDOM means that we must ignore the address_offset. In such a case,
> > +	 * in 64-bit mode the effective address relative to the RIP of the
> > +	 * following instruction.
> > +	 */
> > +	if (*regoff == -EDOM) {
> > +		if (user_64bit_mode(regs))
> > +			tmp = (long)regs->ip + insn->length;
> > +		else
> > +			tmp = 0;
> > +	} else if (*regoff < 0) {
> > +		return -EINVAL;
> > +	} else {
> > +		tmp = (long)regs_get_register(regs, *regoff);
> > +	}
> 
> > +	else
> > +		indx = (long)regs_get_register(regs, indx_offset);
> 
> This and subsequent patches include a disgustly insane amount of type casts - why?
> 
> For example here 'tmp' is 'long', while regs_get_register() returns
> 'unsigned long', but no type cast is necessary for that.
> 
> > +			ret = get_eff_addr_modrm(insn, regs, &addr_offset,
> > +						 &eff_addr);
> 
> Also, please don't break lines slightly longer than 80 cols just to pacify 
> checkpatch (and this holds for other patches as well) - the cure is worse than the 
> illness!

The right thing to do here is to split out stuff into a helper function
which removes the indentation levels or restructure the code to avoid them.

Thanks,

	tglx

Powered by blists - more mailing lists