From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D97A1C433DB for ; Wed, 20 Jan 2021 14:39:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 650F823371 for ; Wed, 20 Jan 2021 14:39:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 650F823371 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E1A166B0005; Wed, 20 Jan 2021 09:39:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC9976B0006; Wed, 20 Jan 2021 09:39:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE0436B0008; Wed, 20 Jan 2021 09:39:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id B817F6B0005 for ; Wed, 20 Jan 2021 09:39:30 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 638C03641 for ; Wed, 20 Jan 2021 14:39:30 +0000 (UTC) X-FDA: 77726411700.21.land82_3815ef52755b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 32DA3180445E0 for ; Wed, 20 Jan 2021 14:39:30 +0000 (UTC) X-HE-Tag: land82_3815ef52755b X-Filterd-Recvd-Size: 3086 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 14:39:29 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id C39892245C; Wed, 20 Jan 2021 14:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611153568; bh=n44JGd/vTF7J6BFMXAiht4O145lHppu2U0ihRFRAC2M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XVOjpBYrje8sRC+KC0CUB4nD8DlrTa9KrfN4yYjWcGXFz/4HiuaICOOJNUrb/0kJ0 V2+Smmap/YKmG+4QBBruHm7oLJDycM2rtnVZog/3iXLKxdJjgoCCRh4C6nz9dapzeq k6bLb6O5eIF5SK4Got3Cu6Ghx4rgt+LZM1ASKR+Eau8ni53Ty76023X6yxJy1KW/cA ToslcprN435Vl4jQDirIqOnUXH1Abn/ktZrGe1dOGFAeznx4el7B/h7C5QfrZ/MnWY WfSeX/cbjnSQH/ixH1YZGGK/VHV4fdXhPI8XzcqtSE8b4ZR9AtAqPTCWtbrRuNJ1V8 gkC06wEid+3AQ== Date: Wed, 20 Jan 2021 16:39:22 +0200 From: Jarkko Sakkinen To: Tianjia Zhang Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , Shuah Khan , haitao.huang@intel.com, Kai Huang , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Jia Zhang Subject: Re: [PATCH] x86/sgx: Remove redundant if conditions in sgx_encl_create Message-ID: References: <20210118133358.99311-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210118133358.99311-1-tianjia.zhang@linux.alibaba.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 18, 2021 at 09:33:58PM +0800, Tianjia Zhang wrote: > In this scenario, there is no case where va_page is NULL, and > the error has been checked. The if condition statement here is > redundant, so remove the condition detection. > > Reported-by: Jia Zhang > Signed-off-by: Tianjia Zhang What do we gain with this change and why is it reported as a regression? /Jarkko > --- > arch/x86/kernel/cpu/sgx/ioctl.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c > index 90a5caf76939..f45957c05f69 100644 > --- a/arch/x86/kernel/cpu/sgx/ioctl.c > +++ b/arch/x86/kernel/cpu/sgx/ioctl.c > @@ -66,9 +66,8 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs) > va_page = sgx_encl_grow(encl); > if (IS_ERR(va_page)) > return PTR_ERR(va_page); > - else if (va_page) > - list_add(&va_page->list, &encl->va_pages); > - /* else the tail page of the VA page list had free slots. */ > + > + list_add(&va_page->list, &encl->va_pages); > > /* The extra page goes to SECS. */ > encl_size = secs->size + PAGE_SIZE; > -- > 2.19.1.3.ge56e4f7 > >