From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752270AbdLJUTJ (ORCPT ); Sun, 10 Dec 2017 15:19:09 -0500 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:55866 "EHLO mail.osadl.at" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751994AbdLJUTI (ORCPT ); Sun, 10 Dec 2017 15:19:08 -0500 Date: Sun, 10 Dec 2017 20:19:03 +0000 From: Nicholas Mc Guire To: Lukas Bulwahn Cc: Josh Poimboeuf , sil2review@lists.osadl.org, Jiri Slaby , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [SIL2review] [PATCH] objtool: Use value of intended enum to compile with clang Message-ID: <20171210201903.GA13846@osadl.at> References: <1512930902-15731-1-git-send-email-lukas.bulwahn@gmail.com> <1512930902-15731-2-git-send-email-lukas.bulwahn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512930902-15731-2-git-send-email-lukas.bulwahn@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 10, 2017 at 07:35:00PM +0100, Lukas Bulwahn wrote: > Just use the right value and avoid an implicit conversion between the two > enumeration types that just happened to work in this case. It seems that > this must have just been overlooked in the new implementation of objtool > in commit baa41469a7b9 ("objtool: Implement stack validation 2.0"). > > I found this when compiling the kernel with clang-5.0, i.e., executing > > make HOSTCC=clang-5.0 CC=clang-5.0 defconfig && \ > make HOSTCC=clang-5.0 CC=clang-5.0 > > fails with: > > ``` > arch/x86/decode.c:141:20: error: implicit conversion from enumeration type 'enum op_src_type' to different enumeration type 'enum op_dest_type' [-Werror,-Wenum-conversion] > op->dest.type = OP_SRC_REG; > ~ ^~~~~~~~~~ > 1 error generated. > ``` given the declaration in tools/objtool/arch.h enum op_dest_type { OP_DEST_REG, ... enum op_src_type { OP_SRC_REG, ... the change seems correct and it is clear why it worked with the wrong type > > Fixes: baa41469a7b9 ("objtool: Implement stack validation 2.0") > Signed-off-by: Lukas Bulwahn Reviewed-by: Nicholas Mc Guire > --- > tools/objtool/arch/x86/decode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c > index 8acfc47..540a209 100644 > --- a/tools/objtool/arch/x86/decode.c > +++ b/tools/objtool/arch/x86/decode.c > @@ -138,7 +138,7 @@ int arch_decode_instruction(struct elf *elf, struct section *sec, > *type = INSN_STACK; > op->src.type = OP_SRC_ADD; > op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; > - op->dest.type = OP_SRC_REG; > + op->dest.type = OP_DEST_REG; > op->dest.reg = CFI_SP; > } > break; > -- > 2.7.4 > > _______________________________________________ > SIL2review mailing list > SIL2review@lists.osadl.org > https://lists.osadl.org/mailman/listinfo/sil2review