From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247AbdKBIvQ (ORCPT ); Thu, 2 Nov 2017 04:51:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54269 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbdKBIvN (ORCPT ); Thu, 2 Nov 2017 04:51:13 -0400 X-Google-Smtp-Source: ABhQp+TWeB1o1Tv2uFHgiEzLlqrYsmFodUCDKq3isKLY4Hk+ZOiDJBklv8A7QalYejhgigvH00qnVw== Date: Thu, 2 Nov 2017 09:51:08 +0100 From: Ingo Molnar To: Ricardo Neri Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , "Ravi V. Shankar" , Shuah Khan , linux-kernel@vger.kernel.org, x86@kernel.org, ricardo.neri@intel.com, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren , Arnaldo Carvalho de Melo , Adrian Hunter , Kees Cook , Thomas Garnier , Dmitry Vyukov Subject: Re: [PATCH v10 02/13] x86/insn-eval: Compute linear address in several utility functions Message-ID: <20171102085108.pgiem4kplrcmbzh6@gmail.com> References: <1509148310-30862-1-git-send-email-ricardo.neri-calderon@linux.intel.com> <1509148310-30862-3-git-send-email-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1509148310-30862-3-git-send-email-ricardo.neri-calderon@linux.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ricardo Neri 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! Thanks, Ingo