lkml.org 
[lkml]   [2017]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 02/13] x86/insn-eval: Compute linear address in several utility functions
On Thu, Nov 02, 2017 at 12:07:13PM +0100, Thomas Gleixner wrote:
> On Thu, 2 Nov 2017, Ingo Molnar wrote:
>
> > * Ricardo Neri <ricardo.neri-calderon@linux.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.

This patch introduce this several helper function. Perhaps I can add some more. For
this particular case, I think that using shorter variable names will avoid this
problem.

Thanks and BR,
Ricardo

\
 
 \ /
  Last update: 2017-11-03 03:48    [W:0.634 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site