From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751695AbdBXCdc (ORCPT ); Thu, 23 Feb 2017 21:33:32 -0500 Received: from smtprelay0152.hostedemail.com ([216.40.44.152]:50576 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751294AbdBXCda (ORCPT ); Thu, 23 Feb 2017 21:33:30 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2693:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3870:3874:4321:4384:5007:6742:6743:10004:10400:10848:11026:11232:11658:11914:12740:12760:12895:13069:13141:13161:13229:13230:13311:13357:13439:13972:14096:14097:14659:14721:21080:21434:30012:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: line06_57dc981893a2c X-Filterd-Recvd-Size: 3585 Message-ID: <1487903602.14159.50.camel@perches.com> Subject: Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP From: Joe Perches To: Ricardo Neri , Peter Zijlstra Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Liang Z Li , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , Alexandre Julliard , Stas Sergeev , Fenghua Yu , "Ravi V. Shankar" , Shuah Khan , linux-kernel@vger.kernel.org, x86@kernel.org, linux-msdos@vger.kernel.org, wine-devel@winehq.org, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren Date: Thu, 23 Feb 2017 18:33:22 -0800 In-Reply-To: <1487888232.115017.4.camel@ranerica-desktop> References: <20170223063706.71554-1-ricardo.neri-calderon@linux.intel.com> <20170223063706.71554-2-ricardo.neri-calderon@linux.intel.com> <20170223072432.GX6515@twins.programming.kicks-ass.net> <1487888232.115017.4.camel@ranerica-desktop> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-02-23 at 14:17 -0800, Ricardo Neri wrote: > On Thu, 2017-02-23 at 08:24 +0100, Peter Zijlstra wrote: > > On Wed, Feb 22, 2017 at 10:36:50PM -0800, Ricardo Neri wrote: > > > + /* > > > + * A negative offset generally means a error, except > > > + * -EDOM, which means that the contents of the register > > > + * should not be used as index. > > > + */ > > > if (indx_offset < 0) > > > - goto out_err; > > > + if (indx_offset == -EDOM) > > > + indx = 0; > > > + else > > > + goto out_err; > > > + else > > > + indx = regs_get_register(regs, indx_offset); > > > > Kernel coding style requires more brackets than are strictly required by > > C, any block longer than 1 line needs then. Also, if one leg of a > > conditional needs them, then they should be on both legs. > > > > Your code has many such instances, please change them all. > > Will do. Sorry for the noise. These instances escaped the checkpatch > script. Also, this code would read better with the inner test reversed or done first if (indx_offset < 0) { if (indx_offset != -EDOM) goto out_err; indx = 0; } else { indx = regs_get_register(etc...) } or if (indx_offset == -EDOM) indx = 0; else if (indx_offset < 0) goto err; else indx = regs_get_register(etc...) The compiler should generate the same code in any case, but either could improve reader understanding.