All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@google.com>,
	Nick Desaulniers <nick.desaulniers@gmail.com>
Subject: Re: [PATCH] x86/umip: Fix insn_get_code_seg_params()'s return value
Date: Mon, 27 Nov 2017 19:56:35 -0800	[thread overview]
Message-ID: <20171128035635.GA8145@voyager> (raw)
In-Reply-To: <20171123091951.1462-1-bp@alien8.de>

On Thu, Nov 23, 2017 at 10:19:51AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> In order to save on redundant structs definitions
> insn_get_code_seg_params() was made to return two 4-bit values in a char
> but clang complains:
> 
>   arch/x86/lib/insn-eval.c:780:10: warning: implicit conversion from 'int' to 'char'
> 	  changes value from 132 to -124 [-Wconstant-conversion]
>                   return INSN_CODE_SEG_PARAMS(4, 8);
>                   ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
>   ./arch/x86/include/asm/insn-eval.h:16:57: note: expanded from macro 'INSN_CODE_SEG_PARAMS'
>   #define INSN_CODE_SEG_PARAMS(oper_sz, addr_sz) (oper_sz | (addr_sz << 4))
> 
> Those two values do get picked apart afterwards the opposite way of how
> they were ORed so wrt to the LSByte, the return value is the same.
> 
> But this function returns -EINVAL in the error case, which is an int. So
> make it return an int which is the native word size anyway and thus fix
> the clang warning.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Reported-by: Kees Cook <keescook@google.com>
> Reported-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> Cc: ricardo.neri-calderon@linux.intel.com

Thanks Kees and Nick for finding this bug. Thanks Borislav for the quick fix!
This change looks OK to me.

BR,
Ricardo

      parent reply	other threads:[~2017-11-28  3:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23  9:19 Borislav Petkov
2017-11-23 19:25 ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-11-28  3:56 ` Ricardo Neri [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171128035635.GA8145@voyager \
    --to=ricardo.neri-calderon@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=keescook@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick.desaulniers@gmail.com \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH] x86/umip: Fix insn_get_code_seg_params()'\''s return value' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.