Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp274449pxb; Wed, 20 Jan 2021 06:50:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxH4kD9+FxC5OmsEbopl7bghvnOGzuLmDLuUzythlB1WF3vUqmIO0ICstlTFD/JnfIqMw2k X-Received: by 2002:a17:906:7798:: with SMTP id s24mr6431290ejm.19.1611154217287; Wed, 20 Jan 2021 06:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611154217; cv=none; d=google.com; s=arc-20160816; b=Y2UuRAAx26umAB/y8+c7nSL0HUSmwQg7ts2xVhvn6k8az+23Mu72k/CQ0oRNAc16yl Xm9Cn2dqCjlb7lxsb/OPzspl+UEZrmDyltiMD37HzutSbj5Dti5dYHSu4ynJ66RRqubN hdXWURYfKzmu3z9K3zJ0wv76bwjCZ8s50YerzI5Ao/VJNmV1WDdsEf134aWm66a1sOsJ hkFVtj3one9/xmATYfMmFoA0LdYjUjkrcD9VJxaRWgA/axbJcthy/XKc58iIEm+SGGqd NFcj8E5J+Pd8nyTzr/A2ge1RM/qJWEMoUCDfPqfBgreZ/+J+ybAF/tk8tySsS1CxuJM1 uLzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Nx+3a+0GD7MpxsefyX3uZ/cLnul3AbbcswRbR71HK14=; b=GV0IlIbpL8khtJhi/Xr9jYtuvTrjv4aAJzsWSUUxa5ffkviJaHiC6FxMD5jI0K9yqL 9hlKXYwdHxgcIV1xq2K0VWBRu9OIxd/X4KzXr0GSakoii9G9HF5aok5g/FSbWo+xFrVn GG1JaPCGNeDdk76/EmZLQa3m85iNMAcH0E5tALl+BXoAxtkFhp1KKilzO98iDpwgRHLz r3NObfuZkRbmE4U/80vPRV8QvkyHYxKjqVwC9hWElxgAlA1dffQpW8OqPb6RU/mA05nQ FLIL+woRx/3CsnosAaYyMmjZSX2kPg9qZi/XOPbJEnu+3mfkM0Q6NF+iI31VmnvBI52d 0ALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XVOjpBYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si741070ejo.417.2021.01.20.06.49.52; Wed, 20 Jan 2021 06:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XVOjpBYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390866AbhATOoO (ORCPT + 99 others); Wed, 20 Jan 2021 09:44:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:42796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390418AbhATOkJ (ORCPT ); Wed, 20 Jan 2021 09:40:09 -0500 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >