From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753324AbdJTRMl (ORCPT ); Fri, 20 Oct 2017 13:12:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:42595 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753245AbdJTRMk (ORCPT ); Fri, 20 Oct 2017 13:12:40 -0400 Date: Fri, 20 Oct 2017 19:12:30 +0200 From: Borislav Petkov To: Ricardo Neri Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , 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 v9 19/29] x86/insn-eval: Add support to resolve 32-bit address encodings Message-ID: <20171020171229.pofottubbjnwgmws@pd.tnic> References: <1507089272-32733-1-git-send-email-ricardo.neri-calderon@linux.intel.com> <1507089272-32733-20-git-send-email-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1507089272-32733-20-git-send-email-ricardo.neri-calderon@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 03, 2017 at 08:54:22PM -0700, Ricardo Neri wrote: > The new function get_addr_ref_32() is almost identical to the existing > function insn_get_addr_ref() (used for 64-bit addresses); except for the > differences mentioned above. For the sake of simplicity and readability, > it is better to use two separate functions. You're kidding, right? You're not adding another small function - this new one is just as big. And almost identical. So if you split the whole handling into helpers - for example, each if-clause is doing very similar things - you can carve out the repeating pieces into helpers and then call them each time with the respective parameters, you can get rid of all that needless duplication. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --